Documentation ¶
Index ¶
- type User
- type UserDB
- func (m *UserDB) Add(ctx context.Context, model *User) error
- func (m *UserDB) DB() interface{}
- func (m *UserDB) Delete(ctx context.Context, id int) error
- func (m *UserDB) Get(ctx context.Context, id int) (*User, error)
- func (m *UserDB) List(ctx context.Context) ([]*User, error)
- func (m *UserDB) ListApplicationVndUser(ctx context.Context) []*app.ApplicationVndUser
- func (m *UserDB) OneApplicationVndUser(ctx context.Context, id int) (*app.ApplicationVndUser, error)
- func (m *UserDB) TableName() string
- func (m *UserDB) Update(ctx context.Context, model *User) error
- func (m *UserDB) UpdateFromUserPayload(ctx context.Context, payload *app.UserPayload, id int) error
- type UserStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type User ¶
type User struct { ID int `gorm:"primary_key"` // This is the User Model PK field CreatedAt time.Time DeletedAt *time.Time Description string Title string UpdatedAt time.Time }
User Model Description
func UserFromUserPayload ¶
func UserFromUserPayload(payload *app.UserPayload) *User
UserFromUserPayload Converts source UserPayload to target User model only copying the non-nil fields from the source.
func (User) TableName ¶
TableName overrides the table name settings in Gorm to force a specific table name in the database.
func (*User) UserToApplicationVndUser ¶
func (m *User) UserToApplicationVndUser() *app.ApplicationVndUser
UserToApplicationVndUser loads a User and builds the default view of media type ApplicationVndUser.
type UserDB ¶
UserDB is the implementation of the storage interface for User.
func (*UserDB) Get ¶
Get returns a single User as a Database Model This is more for use internally, and probably not what you want in your controllers
func (*UserDB) ListApplicationVndUser ¶
func (m *UserDB) ListApplicationVndUser(ctx context.Context) []*app.ApplicationVndUser
ListApplicationVndUser returns an array of view: default.
func (*UserDB) OneApplicationVndUser ¶
func (m *UserDB) OneApplicationVndUser(ctx context.Context, id int) (*app.ApplicationVndUser, error)
OneApplicationVndUser loads a User and builds the default view of media type ApplicationVndUser.
func (*UserDB) TableName ¶
TableName overrides the table name settings in Gorm to force a specific table name in the database.
func (*UserDB) UpdateFromUserPayload ¶
UpdateFromUserPayload applies non-nil changes from UserPayload to the model and saves it
type UserStorage ¶
type UserStorage interface { DB() interface{} List(ctx context.Context) ([]*User, error) Get(ctx context.Context, id int) (*User, error) Add(ctx context.Context, user *User) error Update(ctx context.Context, user *User) error Delete(ctx context.Context, id int) error ListApplicationVndUser(ctx context.Context) []*app.ApplicationVndUser OneApplicationVndUser(ctx context.Context, id int) (*app.ApplicationVndUser, error) UpdateFromUserPayload(ctx context.Context, payload *app.UserPayload, id int) error }
UserStorage represents the storage interface.