// SetField sets the value of a field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
SetField sets the value of a field with the given name. It returns an error if
the field is not defined in the schema, or if the type mismatched the field
type.
// SetField sets the value of a field with the given name . It returns an error if // the field is not defined in the schema or if the type mismatched the field // type .
func (m *APIAuditMutation) SetField(name string, value ent.Value) error {
	switch name {
	case apiaudit.FieldCreatedAt:
		v, ok := value.(time.Time)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetCreatedAt(v)
		return nil
	case apiaudit.FieldUpdatedAt:
		v, ok := value.(time.Time)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetUpdatedAt(v)
		return nil
	case apiaudit.FieldDeletedAt:
		v, ok := value.(time.Time)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetDeletedAt(v)
		return nil
	case apiaudit.FieldPlane:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetPlane(v)
		return nil
	case apiaudit.FieldHashedGrantToken:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetHashedGrantToken(v)
		return nil
	case apiaudit.FieldDomain:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetDomain(v)
		return nil
	case apiaudit.FieldHTTPPath:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetHTTPPath(v)
		return nil
	case apiaudit.FieldHTTPMethod:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetHTTPMethod(v)
		return nil
	case apiaudit.FieldSentHTTPStatus:
		v, ok := value.(int)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetSentHTTPStatus(v)
		return nil
	}
	return fmt.Errorf("unknown APIAudit field %s", name)
}
func ( m * APIAuditMutation ) SetField ( name string , value ent . Value ) error { switch name { case apiaudit . FieldCreatedAt : v , ok := value . ( time . Time ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetCreatedAt ( v ) return nil case apiaudit . FieldUpdatedAt : v , ok := value . ( time . Time ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetUpdatedAt ( v ) return nil case apiaudit . FieldDeletedAt : v , ok := value . ( time . Time ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetDeletedAt ( v ) return nil case apiaudit . FieldPlane : v , ok := value . ( string ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetPlane ( v ) return nil case apiaudit . FieldHashedGrantToken : v , ok := value . ( string ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetHashedGrantToken ( v ) return nil case apiaudit . FieldDomain : v , ok := value . ( string ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetDomain ( v ) return nil case apiaudit . FieldHTTPPath : v , ok := value . ( string ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetHTTPPath ( v ) return nil case apiaudit . FieldHTTPMethod : v , ok := value . ( string ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetHTTPMethod ( v ) return nil case apiaudit . FieldSentHTTPStatus : v , ok := value . ( int ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetSentHTTPStatus ( v ) return nil } return fmt . Errorf ( " " , name ) }
SetField sets the value of a field with the given name.
SetField sets the value of a field with the given name .