model

package
v0.0.0-...-225f367 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserTabColumn_Id       string = "id"
	UserTabColumn_Username string = "username"
	UserTabColumn_Password string = "password"
	UserTabColumn_Nickname string = "nickname"
	UserTabColumn_Email    string = "email"
	UserTabColumn_Avatar   string = "avatar"
)

Variables

View Source
var ErrInvalidArgument = errors.New("invalid arguments")

Functions

func IsInvalidArgumentError

func IsInvalidArgumentError(err error) bool

IsInvalidArgumentError returns true if err represents a ErrInvalidArgument error.

func IsRecordNotFound

func IsRecordNotFound(err error) bool

IsRecordNotFound returns true if err represents a RecordNotFound error.

Types

type UserTab

type UserTab struct {
	Id       int64  `gorm:"column:id"`
	Username string `gorm:"column:username"` // the username
	Password string `gorm:"column:password"`
	Nickname string `gorm:"column:nickname"` // nickname
	Email    string `gorm:"column:email"`    // user email address
	Avatar   string `gorm:"column:avatar"`
}

UserTab describes the table schema structure.

func (UserTab) TableName

func (UserTab) TableName() string

TableName returns the table name.

type UserTabModel

type UserTabModel interface {
	Insert(ctx context.Context, data *UserTab) error
	Delete(ctx context.Context, id int64) error
	Update(ctx context.Context, data *UserTab) error
	FindOne(ctx context.Context, id int64) (*UserTab, error)
	FindOneByEmail(ctx context.Context, email string) (*UserTab, error)
	FindOneByUsername(ctx context.Context, username string) (*UserTab, error)
	Query(ctx context.Context, filters string, opts ...options.QueryOption) ([]*UserTab, int64, error)
	WithDB(db *gorm.DB) UserTabModel
}

UserTabModel is an interface that wraps the CURD method.

func NewUserTabModel

func NewUserTabModel(conn *gorm.DB) UserTabModel

NewUserTabModel creates a defaultUserTabModel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL