Documentation
¶
Overview ¶
Package users represents the user resource
Index ¶
Constants ¶
View Source
const ( // TableName is the database table for this resource TableName = "users" // KeyName is the primary key value for this resource KeyName = "id" // Order defines the default sort order in sql for this resource Order = "name asc, id desc" )
View Source
const ( Anon = 0 Editor = 10 Reader = 20 Admin = 100 )
User roles
Variables ¶
This section is empty.
Functions ¶
func AllowedParams ¶
func AllowedParams() []string
AllowedParams returns an array of allowed param keys for Update and Create.
Types ¶
type User ¶
type User struct {
// resource.Base defines behaviour and fields shared between all resources
resource.Base
// status.ResourceStatus defines a status field and associated behaviour
status.ResourceStatus
// Authorisation
Role int64
// Authentication
PasswordHash string
PasswordResetToken string
PasswordResetAt time.Time
// User details
Email string
Name string
Title string
Summary string
Text string
ImageID int64
}
User handles saving and retreiving users from the database
func FindFirst ¶
FindFirst fetches a single user record from the database using a where query with the format and args provided.
func NewWithColumns ¶
NewWithColumns creates a new user instance and fills it with data from the database cols provided.
func (*User) RoleDisplay ¶
RoleDisplay returns the string representation of the Role status
func (*User) RoleOptions ¶
RoleOptions returns an array of Role values for this model (embedders may override this and roledisplay to extend)
func (*User) SelectName ¶
SelectName returns a string representation of the user for select options
Click to show internal directories.
Click to hide internal directories.