|
|
|
@ -6314,17 +6314,20 @@ func (m *OfflineSessionMutation) ResetEdge(name string) error { |
|
|
|
// PasswordMutation represents an operation that mutates the Password nodes in the graph.
|
|
|
|
// PasswordMutation represents an operation that mutates the Password nodes in the graph.
|
|
|
|
type PasswordMutation struct { |
|
|
|
type PasswordMutation struct { |
|
|
|
config |
|
|
|
config |
|
|
|
op Op |
|
|
|
op Op |
|
|
|
typ string |
|
|
|
typ string |
|
|
|
id *int |
|
|
|
id *int |
|
|
|
email *string |
|
|
|
email *string |
|
|
|
hash *[]byte |
|
|
|
hash *[]byte |
|
|
|
username *string |
|
|
|
username *string |
|
|
|
user_id *string |
|
|
|
preferred_username *string |
|
|
|
clearedFields map[string]struct{} |
|
|
|
user_id *string |
|
|
|
done bool |
|
|
|
groups *[]string |
|
|
|
oldValue func(context.Context) (*Password, error) |
|
|
|
appendgroups []string |
|
|
|
predicates []predicate.Password |
|
|
|
clearedFields map[string]struct{} |
|
|
|
|
|
|
|
done bool |
|
|
|
|
|
|
|
oldValue func(context.Context) (*Password, error) |
|
|
|
|
|
|
|
predicates []predicate.Password |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var _ ent.Mutation = (*PasswordMutation)(nil) |
|
|
|
var _ ent.Mutation = (*PasswordMutation)(nil) |
|
|
|
@ -6533,6 +6536,42 @@ func (m *PasswordMutation) ResetUsername() { |
|
|
|
m.username = nil |
|
|
|
m.username = nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SetPreferredUsername sets the "preferred_username" field.
|
|
|
|
|
|
|
|
func (m *PasswordMutation) SetPreferredUsername(s string) { |
|
|
|
|
|
|
|
m.preferred_username = &s |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// PreferredUsername returns the value of the "preferred_username" field in the mutation.
|
|
|
|
|
|
|
|
func (m *PasswordMutation) PreferredUsername() (r string, exists bool) { |
|
|
|
|
|
|
|
v := m.preferred_username |
|
|
|
|
|
|
|
if v == nil { |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return *v, true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// OldPreferredUsername returns the old "preferred_username" field's value of the Password entity.
|
|
|
|
|
|
|
|
// If the Password object wasn't provided to the builder, the object is fetched from the database.
|
|
|
|
|
|
|
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
|
|
|
|
|
|
func (m *PasswordMutation) OldPreferredUsername(ctx context.Context) (v string, err error) { |
|
|
|
|
|
|
|
if !m.op.Is(OpUpdateOne) { |
|
|
|
|
|
|
|
return v, errors.New("OldPreferredUsername is only allowed on UpdateOne operations") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if m.id == nil || m.oldValue == nil { |
|
|
|
|
|
|
|
return v, errors.New("OldPreferredUsername requires an ID field in the mutation") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
oldValue, err := m.oldValue(ctx) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return v, fmt.Errorf("querying old value for OldPreferredUsername: %w", err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return oldValue.PreferredUsername, nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ResetPreferredUsername resets all changes to the "preferred_username" field.
|
|
|
|
|
|
|
|
func (m *PasswordMutation) ResetPreferredUsername() { |
|
|
|
|
|
|
|
m.preferred_username = nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
|
|
func (m *PasswordMutation) SetUserID(s string) { |
|
|
|
func (m *PasswordMutation) SetUserID(s string) { |
|
|
|
m.user_id = &s |
|
|
|
m.user_id = &s |
|
|
|
@ -6569,6 +6608,71 @@ func (m *PasswordMutation) ResetUserID() { |
|
|
|
m.user_id = nil |
|
|
|
m.user_id = nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SetGroups sets the "groups" field.
|
|
|
|
|
|
|
|
func (m *PasswordMutation) SetGroups(s []string) { |
|
|
|
|
|
|
|
m.groups = &s |
|
|
|
|
|
|
|
m.appendgroups = nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Groups returns the value of the "groups" field in the mutation.
|
|
|
|
|
|
|
|
func (m *PasswordMutation) Groups() (r []string, exists bool) { |
|
|
|
|
|
|
|
v := m.groups |
|
|
|
|
|
|
|
if v == nil { |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return *v, true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// OldGroups returns the old "groups" field's value of the Password entity.
|
|
|
|
|
|
|
|
// If the Password object wasn't provided to the builder, the object is fetched from the database.
|
|
|
|
|
|
|
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
|
|
|
|
|
|
|
func (m *PasswordMutation) OldGroups(ctx context.Context) (v []string, err error) { |
|
|
|
|
|
|
|
if !m.op.Is(OpUpdateOne) { |
|
|
|
|
|
|
|
return v, errors.New("OldGroups is only allowed on UpdateOne operations") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if m.id == nil || m.oldValue == nil { |
|
|
|
|
|
|
|
return v, errors.New("OldGroups requires an ID field in the mutation") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
oldValue, err := m.oldValue(ctx) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return v, fmt.Errorf("querying old value for OldGroups: %w", err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return oldValue.Groups, nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// AppendGroups adds s to the "groups" field.
|
|
|
|
|
|
|
|
func (m *PasswordMutation) AppendGroups(s []string) { |
|
|
|
|
|
|
|
m.appendgroups = append(m.appendgroups, s...) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// AppendedGroups returns the list of values that were appended to the "groups" field in this mutation.
|
|
|
|
|
|
|
|
func (m *PasswordMutation) AppendedGroups() ([]string, bool) { |
|
|
|
|
|
|
|
if len(m.appendgroups) == 0 { |
|
|
|
|
|
|
|
return nil, false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return m.appendgroups, true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ClearGroups clears the value of the "groups" field.
|
|
|
|
|
|
|
|
func (m *PasswordMutation) ClearGroups() { |
|
|
|
|
|
|
|
m.groups = nil |
|
|
|
|
|
|
|
m.appendgroups = nil |
|
|
|
|
|
|
|
m.clearedFields[password.FieldGroups] = struct{}{} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GroupsCleared returns if the "groups" field was cleared in this mutation.
|
|
|
|
|
|
|
|
func (m *PasswordMutation) GroupsCleared() bool { |
|
|
|
|
|
|
|
_, ok := m.clearedFields[password.FieldGroups] |
|
|
|
|
|
|
|
return ok |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ResetGroups resets all changes to the "groups" field.
|
|
|
|
|
|
|
|
func (m *PasswordMutation) ResetGroups() { |
|
|
|
|
|
|
|
m.groups = nil |
|
|
|
|
|
|
|
m.appendgroups = nil |
|
|
|
|
|
|
|
delete(m.clearedFields, password.FieldGroups) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Where appends a list predicates to the PasswordMutation builder.
|
|
|
|
// Where appends a list predicates to the PasswordMutation builder.
|
|
|
|
func (m *PasswordMutation) Where(ps ...predicate.Password) { |
|
|
|
func (m *PasswordMutation) Where(ps ...predicate.Password) { |
|
|
|
m.predicates = append(m.predicates, ps...) |
|
|
|
m.predicates = append(m.predicates, ps...) |
|
|
|
@ -6603,7 +6707,7 @@ func (m *PasswordMutation) Type() string { |
|
|
|
// order to get all numeric fields that were incremented/decremented, call
|
|
|
|
// order to get all numeric fields that were incremented/decremented, call
|
|
|
|
// AddedFields().
|
|
|
|
// AddedFields().
|
|
|
|
func (m *PasswordMutation) Fields() []string { |
|
|
|
func (m *PasswordMutation) Fields() []string { |
|
|
|
fields := make([]string, 0, 4) |
|
|
|
fields := make([]string, 0, 6) |
|
|
|
if m.email != nil { |
|
|
|
if m.email != nil { |
|
|
|
fields = append(fields, password.FieldEmail) |
|
|
|
fields = append(fields, password.FieldEmail) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -6613,9 +6717,15 @@ func (m *PasswordMutation) Fields() []string { |
|
|
|
if m.username != nil { |
|
|
|
if m.username != nil { |
|
|
|
fields = append(fields, password.FieldUsername) |
|
|
|
fields = append(fields, password.FieldUsername) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if m.preferred_username != nil { |
|
|
|
|
|
|
|
fields = append(fields, password.FieldPreferredUsername) |
|
|
|
|
|
|
|
} |
|
|
|
if m.user_id != nil { |
|
|
|
if m.user_id != nil { |
|
|
|
fields = append(fields, password.FieldUserID) |
|
|
|
fields = append(fields, password.FieldUserID) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if m.groups != nil { |
|
|
|
|
|
|
|
fields = append(fields, password.FieldGroups) |
|
|
|
|
|
|
|
} |
|
|
|
return fields |
|
|
|
return fields |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -6630,8 +6740,12 @@ func (m *PasswordMutation) Field(name string) (ent.Value, bool) { |
|
|
|
return m.Hash() |
|
|
|
return m.Hash() |
|
|
|
case password.FieldUsername: |
|
|
|
case password.FieldUsername: |
|
|
|
return m.Username() |
|
|
|
return m.Username() |
|
|
|
|
|
|
|
case password.FieldPreferredUsername: |
|
|
|
|
|
|
|
return m.PreferredUsername() |
|
|
|
case password.FieldUserID: |
|
|
|
case password.FieldUserID: |
|
|
|
return m.UserID() |
|
|
|
return m.UserID() |
|
|
|
|
|
|
|
case password.FieldGroups: |
|
|
|
|
|
|
|
return m.Groups() |
|
|
|
} |
|
|
|
} |
|
|
|
return nil, false |
|
|
|
return nil, false |
|
|
|
} |
|
|
|
} |
|
|
|
@ -6647,8 +6761,12 @@ func (m *PasswordMutation) OldField(ctx context.Context, name string) (ent.Value |
|
|
|
return m.OldHash(ctx) |
|
|
|
return m.OldHash(ctx) |
|
|
|
case password.FieldUsername: |
|
|
|
case password.FieldUsername: |
|
|
|
return m.OldUsername(ctx) |
|
|
|
return m.OldUsername(ctx) |
|
|
|
|
|
|
|
case password.FieldPreferredUsername: |
|
|
|
|
|
|
|
return m.OldPreferredUsername(ctx) |
|
|
|
case password.FieldUserID: |
|
|
|
case password.FieldUserID: |
|
|
|
return m.OldUserID(ctx) |
|
|
|
return m.OldUserID(ctx) |
|
|
|
|
|
|
|
case password.FieldGroups: |
|
|
|
|
|
|
|
return m.OldGroups(ctx) |
|
|
|
} |
|
|
|
} |
|
|
|
return nil, fmt.Errorf("unknown Password field %s", name) |
|
|
|
return nil, fmt.Errorf("unknown Password field %s", name) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -6679,6 +6797,13 @@ func (m *PasswordMutation) SetField(name string, value ent.Value) error { |
|
|
|
} |
|
|
|
} |
|
|
|
m.SetUsername(v) |
|
|
|
m.SetUsername(v) |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
|
|
|
|
case password.FieldPreferredUsername: |
|
|
|
|
|
|
|
v, ok := value.(string) |
|
|
|
|
|
|
|
if !ok { |
|
|
|
|
|
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
m.SetPreferredUsername(v) |
|
|
|
|
|
|
|
return nil |
|
|
|
case password.FieldUserID: |
|
|
|
case password.FieldUserID: |
|
|
|
v, ok := value.(string) |
|
|
|
v, ok := value.(string) |
|
|
|
if !ok { |
|
|
|
if !ok { |
|
|
|
@ -6686,6 +6811,13 @@ func (m *PasswordMutation) SetField(name string, value ent.Value) error { |
|
|
|
} |
|
|
|
} |
|
|
|
m.SetUserID(v) |
|
|
|
m.SetUserID(v) |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
|
|
|
|
case password.FieldGroups: |
|
|
|
|
|
|
|
v, ok := value.([]string) |
|
|
|
|
|
|
|
if !ok { |
|
|
|
|
|
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
m.SetGroups(v) |
|
|
|
|
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
return fmt.Errorf("unknown Password field %s", name) |
|
|
|
return fmt.Errorf("unknown Password field %s", name) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -6715,7 +6847,11 @@ func (m *PasswordMutation) AddField(name string, value ent.Value) error { |
|
|
|
// ClearedFields returns all nullable fields that were cleared during this
|
|
|
|
// ClearedFields returns all nullable fields that were cleared during this
|
|
|
|
// mutation.
|
|
|
|
// mutation.
|
|
|
|
func (m *PasswordMutation) ClearedFields() []string { |
|
|
|
func (m *PasswordMutation) ClearedFields() []string { |
|
|
|
return nil |
|
|
|
var fields []string |
|
|
|
|
|
|
|
if m.FieldCleared(password.FieldGroups) { |
|
|
|
|
|
|
|
fields = append(fields, password.FieldGroups) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return fields |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// FieldCleared returns a boolean indicating if a field with the given name was
|
|
|
|
// FieldCleared returns a boolean indicating if a field with the given name was
|
|
|
|
@ -6728,6 +6864,11 @@ func (m *PasswordMutation) FieldCleared(name string) bool { |
|
|
|
// ClearField clears the value of the field with the given name. It returns an
|
|
|
|
// ClearField clears the value of the field with the given name. It returns an
|
|
|
|
// error if the field is not defined in the schema.
|
|
|
|
// error if the field is not defined in the schema.
|
|
|
|
func (m *PasswordMutation) ClearField(name string) error { |
|
|
|
func (m *PasswordMutation) ClearField(name string) error { |
|
|
|
|
|
|
|
switch name { |
|
|
|
|
|
|
|
case password.FieldGroups: |
|
|
|
|
|
|
|
m.ClearGroups() |
|
|
|
|
|
|
|
return nil |
|
|
|
|
|
|
|
} |
|
|
|
return fmt.Errorf("unknown Password nullable field %s", name) |
|
|
|
return fmt.Errorf("unknown Password nullable field %s", name) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -6744,9 +6885,15 @@ func (m *PasswordMutation) ResetField(name string) error { |
|
|
|
case password.FieldUsername: |
|
|
|
case password.FieldUsername: |
|
|
|
m.ResetUsername() |
|
|
|
m.ResetUsername() |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
|
|
|
|
case password.FieldPreferredUsername: |
|
|
|
|
|
|
|
m.ResetPreferredUsername() |
|
|
|
|
|
|
|
return nil |
|
|
|
case password.FieldUserID: |
|
|
|
case password.FieldUserID: |
|
|
|
m.ResetUserID() |
|
|
|
m.ResetUserID() |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
|
|
|
|
case password.FieldGroups: |
|
|
|
|
|
|
|
m.ResetGroups() |
|
|
|
|
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
return fmt.Errorf("unknown Password field %s", name) |
|
|
|
return fmt.Errorf("unknown Password field %s", name) |
|
|
|
} |
|
|
|
} |
|
|
|
|