models

package
v0.0.0-...-9cb7876 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PageNum  = 1
	PageSize = 20
)

Page PageSize Number of data items per page

Variables

This section is empty.

Functions

func DefaultPageNum

func DefaultPageNum(pageNum interface{}) uint

func DefaultPageSize

func DefaultPageSize(pageSize interface{}) uint

func Paginate

func Paginate(pageInfo request.PageInfo) func(db *gorm.DB) *gorm.DB

Paginate 分页查询

Types

type Contract

type Contract struct {
	GormModel
	UserID             uint              `gorm:"NOT NULL" json:"userID"`
	ProxyAddress       string            `gorm:"NOT NULL;uniqueIndex:idx_uni;type:varchar(64)" json:"proxyAddress"`
	ProxyOwner         string            `gorm:"NOT NULL" json:"proxyOwner"`
	Name               string            `json:"name"`
	Network            uint              `gorm:"NOT NULL;uniqueIndex:idx_uni;type:varchar(64)" json:"network"` // chain id
	LastUpdate         uint64            `json:"lastUpdate"`
	Email              string            `json:"email"`
	ContractHistoryArr []ContractHistory `json:"contractHistoryArr,omitempty"`
}

Contract .

type ContractHistory

type ContractHistory struct {
	GormModel
	ContractID    uint   `json:"contractId"`
	UpdateBlock   uint64 `json:"updateBlock"`
	UpdateTime    uint64 `json:"updateTime"`
	UpdateTX      string `json:"updateTX"`
	PreviousOwner string `json:"previousOwner"`
	NewOwner      string `json:"newOwner"`
}

type GormModel

type GormModel struct {
	ID        uint       `json:"id" gorm:"primary_key"`
	CreatedAt int64      `json:"createdAt" sql:"index"`
	UpdatedAt int64      `json:"updatedAt"`
	DeletedAt *time.Time `json:"-" sql:"index"`
}

GormModel base user

type User

type User struct {
	GormModel
	Name        string     `json:"name"`
	Address     string     `gorm:"NOT NULL;uniqueIndex:idx_uni;type:varchar(64)" json:"address"`
	Email       string     `json:"email"`
	ContractArr []Contract `json:"contractArr,omitempty"`
}

User .

Jump to

Keyboard shortcuts

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