Documentation
¶
Index ¶
Constants ¶
View Source
const ( // OwnerPerm defines the general permission for an owner. OwnerPerm = "owner" // AdminPerm defines the general permission for an admin. AdminPerm = "admin" // UserPerm defines the general permission for an user. UserPerm = "user" )
View Source
const ( // UserGroupOwnerPerm defines the permission for an owner on user groups. UserGroupOwnerPerm = OwnerPerm // UserGroupAdminPerm defines the permission for an admin on user groups. UserGroupAdminPerm = AdminPerm // UserGroupUserPerm defines the permission for an user on user groups. UserGroupUserPerm = UserPerm )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Group ¶
type Group struct {
bun.BaseModel `bun:"table:groups"`
ID string `bun:",pk,type:varchar(20)"`
Scim string `bun:"type:varchar(255)"`
Slug string `bun:",unique,type:varchar(255)"`
Name string `bun:"type:varchar(255)"`
CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
Users []*UserGroup `bun:"rel:has-many,join:id=group_id"`
}
Group defines the model for groups table.
type ListParams ¶
ListParams defines optional list attributes.
type User ¶
type User struct {
bun.BaseModel `bun:"table:users"`
ID string `bun:",pk,type:varchar(20)"`
Scim string `bun:"type:varchar(255)"`
Username string `bun:",unique,type:varchar(255)"`
Password string `bun:"-"`
Hashword string `bun:"type:varchar(255)"`
Email string `bun:"type:varchar(255)"`
Fullname string `bun:"type:varchar(255)"`
Profile string `bun:"-"`
Active bool `bun:"default:false"`
Admin bool `bun:"default:false"`
CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
Auths []*UserAuth `bun:"rel:has-many,join:id=user_id"`
Groups []*UserGroup `bun:"rel:has-many,join:id=user_id"`
}
User defines the model for users table.
type UserAuth ¶
type UserAuth struct {
bun.BaseModel `bun:"table:user_auths"`
ID string `bun:",pk,type:varchar(20)"`
UserID string `bun:"type:varchar(20)"`
User *User `bun:"rel:belongs-to,join:user_id=id"`
Provider string `bun:"type:varchar(255)"`
Ref string `bun:"type:varchar(255)"`
Login string `bun:"type:varchar(255)"`
Email string `bun:"type:varchar(255)"`
Name string `bun:"type:varchar(255)"`
CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
}
UserAuth defines the model for user_auths table.
type UserGroup ¶
type UserGroup struct {
bun.BaseModel `bun:"table:user_groups"`
UserID string `bun:",pk,type:varchar(20)"`
User *User `bun:"rel:belongs-to,join:user_id=id"`
GroupID string `bun:",pk,type:varchar(20)"`
Group *Group `bun:"rel:belongs-to,join:group_id=id"`
Perm string `bun:"type:varchar(32)"`
CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
}
UserGroup defines the model for user_groups table.
type UserGroupParams ¶
type UserGroupParams struct {
ListParams
UserID string
GroupID string
Perm string
}
UserGroupParams defines parameters for user groups.
type UserToken ¶
type UserToken struct {
bun.BaseModel `bun:"table:user_tokens"`
ID string `bun:",pk,type:varchar(20)"`
UserID string `bun:"type:varchar(20)"`
User *User `bun:"rel:belongs-to,join:user_id=id"`
Kind UserTokenKind `bun:"type:varchar(128)"`
Token string `bun:",unique,type:varchar(128)"`
CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
}
UserToken defines the model for user_tokens table.
type UserTokenKind ¶
type UserTokenKind string
UserTokenKind is the custom type for kind of tokens.
const ( // UserTokenKindRedirect defines the kind used for redirects. UserTokenKindRedirect UserTokenKind = "redirect" )
Click to show internal directories.
Click to hide internal directories.