core

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func DBSetup

func DBSetup(c *DBOption)

DBSetup initializes the database instance

Types

type DBOption

type DBOption struct {
	User         string
	Password     string
	Host         string
	Name         string
	LogMode      bool
	MaxIdleConns int
	MaxOpenConns int
	TbPrefix     string
}

type Model

type Model struct {
	ID        int    `gorm:"primary_key" json:"id" example:"主键ID"`
	CreatedAt uint64 `gorm:"column:created_at;autoCreateTime" json:"created_at" example:"记录添加时间"`
	UpdatedAt uint64 `gorm:"column:updated_at;autoUpdateTime" json:"updated_at" example:"记录更新时间"`
}

func (*Model) BatchInsert

func (p *Model) BatchInsert(tableName string, fields []string, data []map[string]interface{})

func (*Model) BatchInsertWithError

func (p *Model) BatchInsertWithError(tableName string, fields []string, data []map[string]interface{}) error

func (*Model) GetDB

func (p *Model) GetDB() *gorm.DB

func (*Model) LoadAllWhere

func (p *Model) LoadAllWhere(where map[string]map[string]interface{}, model *gorm.DB) *gorm.DB

func (*Model) LoadWhereAnd

func (p *Model) LoadWhereAnd(where map[string]interface{}, model *gorm.DB) *gorm.DB

func (*Model) LoadWhereOr

func (p *Model) LoadWhereOr(where map[string]interface{}, model *gorm.DB) *gorm.DB

func (*Model) ORMModel

func (p *Model) ORMModel()

ORMModel implement flag interface ORMModel

type ORMModel

type ORMModel interface {
	ORMModel()
}

type RuleSearchText

type RuleSearchText interface {
	// contains filtered or unexported methods
}

type RuleSort

type RuleSort interface {
	// contains filtered or unexported methods
}

type SearchTextRule

type SearchTextRule struct {
	SearchText string `json:"search_text" form:"search_text" valid:"stringlength(0|50)~搜索关键词应在0-50个字之间"`
}

type Service

type Service struct{}

func (*Service) ParseDateTime

func (p *Service) ParseDateTime(startTime, endTime int, timeField string, whereAnd map[string]interface{}) map[string]interface{}

func (*Service) ParseSearchText

func (p *Service) ParseSearchText(searchText string, fields *[]string, whereAnd map[string]interface{}, isOr bool) map[string]interface{}

func (*Service) ParseSort

func (p *Service) ParseSort(sort string) string

type SortRule

type SortRule struct {
	Sort string `json:"sort" form:"sort" valid:"-"`
}

Directories

Path Synopsis
conn
ws
middlewares

Jump to

Keyboard shortcuts

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