database

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package database

@author: xwc1125

Package database

@author: xwc1125

Index

Constants

View Source
const (
	StatusType_Delete = iota - 1
	StatusType_Disable
	StatusType_Ok
	StatusType_NotApproved
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CursorResult

type CursorResult struct {
	Results interface{} `json:"results"` // 数据
	Cursor  string      `json:"cursor"`  // 下一页
}

CursorResult Cursor分页返回数据

type ModelBy

type ModelBy struct {
	CreateBy int64 `json:"createBy" xorm:"bigint(20) comment('创建者')" gorm:"index;size:20;comment:创建者"` // 创建者
	UpdateBy int64 `json:"updateBy" xorm:"bigint(20) comment('更新者')" gorm:"index;size:20;comment:更新者"` // 更新者
}

func (*ModelBy) SetCreateBy

func (e *ModelBy) SetCreateBy(createBy int64)

SetCreateBy 设置创建人id

func (*ModelBy) SetUpdateBy

func (e *ModelBy) SetUpdateBy(updateBy int64)

SetUpdateBy 设置修改人id

type ModelID

type ModelID struct {
	Id int64 `` // ID
	/* 154-byte string literal not displayed */
}

type ModelStatus

type ModelStatus struct {
	Status int64 `` // 状态:状态:-1:已删除,0:被禁用,1:正常,2:未审批
	/* 256-byte string literal not displayed */
	Remark string `json:"remark" xorm:"varchar(500) comment('备注')" gorm:"size:500;content:备注"` // 备注
}

type ModelTime

type ModelTime struct {
	CreatedAt int64 `` // 创建时间(毫秒)
	/* 175-byte string literal not displayed */
	UpdatedAt int64 `` // 更新时间(毫秒)
	/* 175-byte string literal not displayed */
	DeletedAt int64 `json:"-" xorm:"bigint(15) deleted comment('删除时间(毫秒)')" gorm:"type:bigint(15);index;comment:删除时间(毫秒)"` // 删除时间(毫秒)
}

type MysqlConfig

type MysqlConfig struct {
	Driver          string `json:"driver" mapstructure:"driver"`
	Url             string `json:"url" mapstructure:"url"`
	Username        string `json:"username" mapstructure:"username"`
	Password        string `json:"password" mapstructure:"password"`
	Secret          string `json:"secret" mapstructure:"secret"`
	MaxIdleConns    int    `json:"max_idle_conns" mapstructure:"max_idle_conns"`
	MaxOpenConns    int    `json:"max_open_conns" mapstructure:"max_open_conns"`
	ConnMaxLifetime int    `json:"conn_max_lifetime" mapstructure:"conn_max_lifetime"`
	ConnMaxIdleTime int    `json:"conn_max_idle_time" mapstructure:"conn_max_idle_time"`
	PrefixTable     string `json:"prefix_table" mapstructure:"prefix_table"`
	PrefixColumn    string `json:"prefix_column" mapstructure:"prefix_column"`
	ShowSQL         bool   `json:"show_sql" mapstructure:"show_sql"`
	LogLevel        int    `json:"log_level" mapstructure:"log_level"`
}

func (MysqlConfig) DSN

func (d MysqlConfig) DSN() string

DSN datasource

func (MysqlConfig) DSNPrint

func (d MysqlConfig) DSNPrint() string

DSNPrint dns pring

type OrderByCol

type OrderByCol struct {
	Column string // 排序字段
	Asc    bool   // 是否正序
}

OrderByCol 排序信息

type PageResult

type PageResult struct {
	Page    *Paging     `json:"page"`    // 分页信息
	Results interface{} `json:"results"` // 数据
}

PageResult 分页返回数据

type PageWhereOrder

type PageWhereOrder struct {
	Order string
	Where string
	Value []interface{}
}

PageWhereOrder 分页条件

type Paging

type Paging struct {
	Page  int `json:"page"`  // 页码
	Limit int `json:"limit"` // 每页条数
	Total int `json:"total"` // 总数据条数
}

Paging 分页请求数据

func (*Paging) Offset

func (p *Paging) Offset() int

func (*Paging) TotalPage

func (p *Paging) TotalPage() int

type StatusType

type StatusType int64

StatusType 状态:-1:已删除,0:被禁用,1:正常,2:未审批

Directories

Path Synopsis
Package db_gorm
Package db_gorm
Package db_xorm
Package db_xorm
Package es
Package es
Package kafka
Package kafka
Package redis
Package redis
Package sqlite
Package sqlite

Jump to

Keyboard shortcuts

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