Documentation ¶
Index ¶
- Constants
- func CreateUser(c *gin.Context, user *model.User) error
- func DeleteUser(c *gin.Context, id int) error
- func GetLastUser(c *gin.Context) (*model.User, error)
- func GetUser(c *gin.Context, username string) (*model.User, error)
- func GetUserAfter(c *gin.Context, id int) (*model.User, error)
- func ToContext(c Setter, store Store)
- func UpdateUser(c *gin.Context, user *model.User) error
- type Setter
- type Store
Constants ¶
View Source
const Key = "store"
Key is the key name of the store in the Gin context.
Variables ¶
This section is empty.
Functions ¶
func CreateUser ¶
CreateUser creates a new user account.
func DeleteUser ¶
DeleteUser deletes the user by the user identifier.
func GetLastUser ¶
GetLastUser gets the last user.
func GetUserAfter ¶
GetUserAfter gets the user who is registered after the specified user.
Types ¶
type Setter ¶
type Setter interface {
Set(string, interface{})
}
Setter defines a context that enables setting values.
type Store ¶
type Store interface { CreateUser(*model.User) error GetUser(string) (*model.User, error) GetLastUser() (*model.User, error) GetUserAfter(int) (*model.User, error) DeleteUser(int) error UpdateUser(*model.User) error }
Store wraps the functions that interactive with the database, just like the Model in MVC architecture.
func FromContext ¶
FromContext returns the Store associated with this context.
Click to show internal directories.
Click to hide internal directories.