database

package
v0.0.0-...-f278672 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//DB is sqlx.DB对象
	DB *sqlx.DB
)

Functions

func Init

func Init(dns string) error

Init 初始化数据库

Types

type PagerQuery

type PagerQuery struct {
	PageSize  int `json:"pagesize"`
	PageIndex int `json:"pageindex"`
}

PagerQuery 分页查询参数

type PagerResult

type PagerResult struct {
	Total     int64 `json:"total,string"`
	PageSize  int   `json:"pagesize"`
	PageIndex int   `json:"pageindex"`
}

PagerResult 分页查询返回值

func NewPagerResult

func NewPagerResult(q PagerQuery) (r PagerResult)

NewPagerResult ...

type Snowflake

type Snowflake struct {
	sync.Mutex
	// contains filtered or unexported fields
}

A Snowflake struct holds the basic information needed for a snowflake generator worker

func NewSnowflake

func NewSnowflake(workerid int64) *Snowflake

NewSnowflake returns a new snowflake worker that can be used to generate snowflake IDs

func (*Snowflake) Generate

func (s *Snowflake) Generate() int64

Generate creates and returns a unique snowflake ID

type TableModel

type TableModel struct {
	ID         int64  `json:"id,string" db:"id"`
	CreatorID  int64  `json:"creator_id" db:"creator_id"`
	Creator    string `json:"creator" db:"creator"`
	CreatorIP  string `json:"creator_ip" db:"creator_ip"`
	CreateTime string `json:"create_time" db:"create_time"`
	ModifierID int64  `json:"modifier_id" db:"modifier_id"`
	Modifier   string `json:"modifier" db:"modifier"`
	ModifierIP string `json:"modifier_ip" db:"modifier_ip"`
	ModifyTime string `json:"modify_time" db:"modify_time" gorm:"default:NULL"`
	DeleteTag  int    `json:"delete_tag" db:"delete_tag"`
}

TableModel 包含基础字段

func (*TableModel) Create

func (t *TableModel) Create(c *gin.Context)

Create ...

func (*TableModel) Modify

func (t *TableModel) Modify(c *gin.Context)

Modify ...

Jump to

Keyboard shortcuts

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