model

package
v0.0.0-...-ec63d53 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func AddUser

func AddUser(name string, password string, age int, gender int, email string) error

func DelUser

func DelUser(id int) error

func InitDB

func InitDB(conf lib.ServerConfig)

func UptUser

func UptUser(id int, data interface{}) error

Types

type Model

type Model struct {
	ID         int `gorm:"primary_key" json:"id"`
	CreatedOn  int `json:"created_on"`
	ModifiedOn int `json:"modified_on"`
	DeletedOn  int `json:"deleted_on"`
}

type Page

type Page struct {
	TotalCount int
	List       interface{}
}

func UsersList

func UsersList(pageNo int, pageSize int, args ...interface{}) (page Page)

通过 args可以动态传递多个参数

type User

type User struct {
	ID        int    `json:"id" gorm:"index"`
	Username  string `json:"username"`
	Password  string `json:"-"`
	Age       int    `json:"age"`
	Email     string `json:"email"`
	Gender    int    `json:"gender"`
	CreatedAt int64  `json:"created_at"`
	UpdatedAt int64  `json:"updated_at"`
}

func GetUserById

func GetUserById(id int) ([]*User, error)

Jump to

Keyboard shortcuts

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