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.
(name string, value ent.Value)
| 8965 | // the field is not defined in the schema, or if the type mismatched the field |
| 8966 | // type. |
| 8967 | func (m *OAuthClientMutation) SetField(name string, value ent.Value) error { |
| 8968 | switch name { |
| 8969 | case oauthclient.FieldCreatedAt: |
| 8970 | v, ok := value.(time.Time) |
| 8971 | if !ok { |
| 8972 | return fmt.Errorf("unexpected type %T for field %s", value, name) |
| 8973 | } |
| 8974 | m.SetCreatedAt(v) |
| 8975 | return nil |
| 8976 | case oauthclient.FieldUpdatedAt: |
| 8977 | v, ok := value.(time.Time) |
| 8978 | if !ok { |
| 8979 | return fmt.Errorf("unexpected type %T for field %s", value, name) |
| 8980 | } |
| 8981 | m.SetUpdatedAt(v) |
| 8982 | return nil |
| 8983 | case oauthclient.FieldDeletedAt: |
| 8984 | v, ok := value.(time.Time) |
| 8985 | if !ok { |
| 8986 | return fmt.Errorf("unexpected type %T for field %s", value, name) |
| 8987 | } |
| 8988 | m.SetDeletedAt(v) |
| 8989 | return nil |
| 8990 | case oauthclient.FieldGUID: |
| 8991 | v, ok := value.(string) |
| 8992 | if !ok { |
| 8993 | return fmt.Errorf("unexpected type %T for field %s", value, name) |
| 8994 | } |
| 8995 | m.SetGUID(v) |
| 8996 | return nil |
| 8997 | case oauthclient.FieldSecret: |
| 8998 | v, ok := value.(string) |
| 8999 | if !ok { |
| 9000 | return fmt.Errorf("unexpected type %T for field %s", value, name) |
| 9001 | } |
| 9002 | m.SetSecret(v) |
| 9003 | return nil |
| 9004 | case oauthclient.FieldName: |
| 9005 | v, ok := value.(string) |
| 9006 | if !ok { |
| 9007 | return fmt.Errorf("unexpected type %T for field %s", value, name) |
| 9008 | } |
| 9009 | m.SetName(v) |
| 9010 | return nil |
| 9011 | case oauthclient.FieldHomepageURL: |
| 9012 | v, ok := value.(string) |
| 9013 | if !ok { |
| 9014 | return fmt.Errorf("unexpected type %T for field %s", value, name) |
| 9015 | } |
| 9016 | m.SetHomepageURL(v) |
| 9017 | return nil |
| 9018 | case oauthclient.FieldRedirectUris: |
| 9019 | v, ok := value.([]string) |
| 9020 | if !ok { |
| 9021 | return fmt.Errorf("unexpected type %T for field %s", value, name) |
| 9022 | } |
| 9023 | m.SetRedirectUris(v) |
| 9024 | return nil |
nothing calls this directly
no test coverage detected