1
0

add handle

This commit is contained in:
2023-06-21 10:17:52 +09:00
parent 9d1f0f73c1
commit e9516ac4cd
18 changed files with 663 additions and 176 deletions

View File

@ -17,6 +17,8 @@ const (
FieldDid = "did"
// FieldDelete holds the string denoting the delete field in the database.
FieldDelete = "delete"
// FieldHandle holds the string denoting the handle field in the database.
FieldHandle = "handle"
// FieldToken holds the string denoting the token field in the database.
FieldToken = "token"
// FieldPassword holds the string denoting the password field in the database.
@ -76,6 +78,7 @@ var Columns = []string{
FieldUsername,
FieldDid,
FieldDelete,
FieldHandle,
FieldToken,
FieldPassword,
FieldCreatedAt,
@ -124,6 +127,8 @@ var (
UsernameValidator func(string) error
// DefaultDelete holds the default value on creation for the "delete" field.
DefaultDelete bool
// DefaultHandle holds the default value on creation for the "handle" field.
DefaultHandle bool
// PasswordValidator is a validator for the "password" field. It is called by the builders before save.
PasswordValidator func(string) error
// DefaultCreatedAt holds the default value on creation for the "created_at" field.

View File

@ -70,6 +70,11 @@ func Delete(v bool) predicate.User {
return predicate.User(sql.FieldEQ(FieldDelete, v))
}
// Handle applies equality check predicate on the "handle" field. It's identical to HandleEQ.
func Handle(v bool) predicate.User {
return predicate.User(sql.FieldEQ(FieldHandle, v))
}
// Token applies equality check predicate on the "token" field. It's identical to TokenEQ.
func Token(v string) predicate.User {
return predicate.User(sql.FieldEQ(FieldToken, v))
@ -330,6 +335,26 @@ func DeleteNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldDelete))
}
// HandleEQ applies the EQ predicate on the "handle" field.
func HandleEQ(v bool) predicate.User {
return predicate.User(sql.FieldEQ(FieldHandle, v))
}
// HandleNEQ applies the NEQ predicate on the "handle" field.
func HandleNEQ(v bool) predicate.User {
return predicate.User(sql.FieldNEQ(FieldHandle, v))
}
// HandleIsNil applies the IsNil predicate on the "handle" field.
func HandleIsNil() predicate.User {
return predicate.User(sql.FieldIsNull(FieldHandle))
}
// HandleNotNil applies the NotNil predicate on the "handle" field.
func HandleNotNil() predicate.User {
return predicate.User(sql.FieldNotNull(FieldHandle))
}
// TokenEQ applies the EQ predicate on the "token" field.
func TokenEQ(v string) predicate.User {
return predicate.User(sql.FieldEQ(FieldToken, v))