// 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 *GrantMutation) SetField(name string, value ent.Value) error {
	switch name {
	case grant.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 grant.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 grant.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 grant.FieldHashedGrantToken:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetHashedGrantToken(v)
		return nil
	case grant.FieldDomain:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetDomain(v)
		return nil
	case grant.FieldVersion:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetVersion(v)
		return nil
	case grant.FieldAllowedHTTPMethods:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetAllowedHTTPMethods(v)
		return nil
	case grant.FieldPaths:
		v, ok := value.([]string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetPaths(v)
		return nil
	}
	return fmt.Errorf("unknown Grant field %s", name)
}
func ( m * GrantMutation ) SetField ( name string , value ent . Value ) error { switch name { case grant . FieldCreatedAt : v , ok := value . ( time . Time ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetCreatedAt ( v ) return nil case grant . FieldUpdatedAt : v , ok := value . ( time . Time ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetUpdatedAt ( v ) return nil case grant . FieldDeletedAt : v , ok := value . ( time . Time ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetDeletedAt ( v ) return nil case grant . FieldHashedGrantToken : v , ok := value . ( string ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetHashedGrantToken ( v ) return nil case grant . FieldDomain : v , ok := value . ( string ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetDomain ( v ) return nil case grant . FieldVersion : v , ok := value . ( string ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetVersion ( v ) return nil case grant . FieldAllowedHTTPMethods : v , ok := value . ( string ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetAllowedHTTPMethods ( v ) return nil case grant . FieldPaths : v , ok := value . ( [ ] string ) if ! ok { return fmt . Errorf ( " " , value , name ) } m . SetPaths ( 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 .