Documentation
¶
Overview ¶
accounts.go
Index ¶
- Constants
- func GenerateId() uint64
- func ValidateEmail(value string) bool
- func ValidateName(value string) bool
- func ValidatePassword(value string) bool
- type Account
- type Client
- func (c *Client) Count(option *SelectOption) (int64, error)
- func (c *Client) CreateTable() error
- func (c *Client) Delete(options []*DeleteOption) error
- func (c *Client) DeleteByPrimaryKey(id uint64) error
- func (c *Client) HasDuplicateForUpdate(option *UpdateOption) (bool, error)
- func (c *Client) Insert(option *InsertOption) error
- func (c *Client) Select(option *SelectOption) ([]*Account, error)
- func (c *Client) SelectByPrimaryKey(id uint64) (*Account, error)
- func (c *Client) SelectByUniqueKey(name string) (*Account, error)
- func (c *Client) Update(id uint64, option *UpdateOption) error
- func (c *Client) UpdateLastLoggedIn(id uint64) error
- type DeleteOption
- type InsertOption
- type Role
- type SelectOption
- type Status
- type UpdateFilter
- type UpdateFilterPrimary
- type UpdateFilterUnique
- type UpdateOption
Constants ¶
View Source
const ( ColCreatedAt = "created_at" ColEmail = "email" ColId = "id" ColLastLoggedIn = "last_logged_in" ColPassword = "password" ColPublicToken = "public_token" ColRole = "role" ColSecretToken = "secret_token" ColStatus = "status" ColUpdatedAt = "updated_at" ColName = "name" TableName = "accounts" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) DeleteByPrimaryKey ¶
Delete by primary key
func (*Client) HasDuplicateForUpdate ¶
func (c *Client) HasDuplicateForUpdate(option *UpdateOption) (bool, error)
Has duplicate for update.
func (*Client) SelectByPrimaryKey ¶
Select by primary key
func (*Client) SelectByUniqueKey ¶
Select by unique key.
func (*Client) UpdateLastLoggedIn ¶
Update last logged In
type DeleteOption ¶
type DeleteOption struct {
Id uint64 `json:"id,string"`
}
type InsertOption ¶
type InsertOption struct {
Id uint64 `json:"id"`
Status Status `json:"status"`
Role Role `json:"role"`
Name *string `json:"name,omitempty"`
Email *string `json:"email,omitempty"`
Password *string `json:"password,omitempty"`
PublicToken *string `json:"publicToken,omitempty"`
SecretToken *string `json:"secretToken,omitempty"`
LastLoggedIn *time.Time `json:"lastLoggedIn,omitempty"`
CreatedAt *time.Time `json:"createdAt,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
}
type SelectOption ¶
type SelectOption struct {
Status *Status `json:"status,omitempty"`
Role *Role `json:"role,omitempty"`
NameLike *string `json:"nameLike,omitempty"`
Email *string `json:"email,omitempty"`
EmailLike *string `json:"emailLike,omitempty"`
LastIdOrLater *uint64 `json:"lastIdOrLater,omitempty"`
LastIdOrEarlier *uint64 `json:"lastIdOrEarlier,omitempty"`
OrderBy string `json:"orderBy"`
OrderByDesc bool `json:"orderByDesc"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
type UpdateFilter ¶
type UpdateFilter struct {
Primary *UpdateFilterPrimary `json:"primary,omitempty"`
Unique *UpdateFilterUnique `json:"unique,omitempty"`
}
type UpdateFilterPrimary ¶
type UpdateFilterPrimary struct {
Id uint64 `json:"id,string"`
}
type UpdateFilterUnique ¶
type UpdateFilterUnique struct {
Name string `json:"name"`
}
type UpdateOption ¶
type UpdateOption struct {
Status *myHelper.UpdateField[Status] `json:"status,omitempty"`
Role *myHelper.UpdateField[Role] `json:"role,omitempty"`
Name *myHelper.UpdateField[string] `json:"name,omitempty"`
Email *myHelper.UpdateField[string] `json:"email,omitempty"`
Password *myHelper.UpdateField[string] `json:"password,omitempty"`
PublicToken *myHelper.UpdateField[string] `json:",omitempty"`
SecretToken *myHelper.UpdateField[string] `json:",omitempty"`
LastLoggedIn *myHelper.UpdateField[time.Time] `json:"lastLoggedIn,omitempty"`
Filter *UpdateFilter `json:"filter,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.