pkg

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MIT Imports: 19 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MysqlConn *gorm.DB
	RedisConn *redis.Client
)
View Source
var ResgterWhereHooks []where.ResiterHooksOption

Functions

func GinRun

func GinRun(port string, fnRouter ...RouterFun) (*http.Server, error)

*@Author Administrator *@Date 31/3/2021 11:36 *@desc

func Http

func Http(engine *gin.Engine, port string) *http.Server

*@Author Administrator *@Date 31/3/2021 11:41 *@desc

func NewConfig

func NewConfig(configList ...ConfigFn) error

func NewMysql

func NewMysql(opt ...gorm.Option) (*gorm.DB, error)

*@Author Administrator *@Date 31/3/2021 10:16 *@desc

func NewRedis

func NewRedis() (*redis.Client, error)

func Order

func Order(dbs *gorm.DB, order map[string]interface{}, orderString string) *gorm.DB

func Where

func Where(dbs *gorm.DB, i interface{}) *gorm.DB

Types

type Buffer

type Buffer struct {
	*bytes.Buffer
}

内嵌bytes.Buffer,支持连写

func NewBuffer

func NewBuffer() *Buffer

func (*Buffer) Append

func (b *Buffer) Append(i interface{}) *Buffer

type CommonRequest

type CommonRequest struct {
	Page        int  `form:"page" `      //当前页码
	IsPaginate  bool `form:"isPaginate"` //当前页码
	PageSize    int  `form:"pageSize"  ` //分页大小
	ReturnType  int  `form:"returnType"` //1 列表  2 map 列表  3 详情
	OrderMap    map[string]interface{}
	OrderString string `form:"orderString"`

	Actions int `form:"action"` //默认 1 修改 2 列表 3 单条数据 4删除 5添加
	Delete  int `form:"delete"` //是否包含删除数据
	Data    interface{}
	Error   error
	// contains filtered or unexported fields
}

func (*CommonRequest) Action

func (c *CommonRequest) Action()

func (*CommonRequest) GetDB

func (c *CommonRequest) GetDB() *gorm.DB

func (*CommonRequest) Init

func (c *CommonRequest) Init(db *gorm.DB, i interface{}) (tx *gorm.DB)

func (*CommonRequest) OrderWhere

func (c *CommonRequest) OrderWhere(i interface{})

func (*CommonRequest) PageLimitOffset

func (c *CommonRequest) PageLimitOffset() int

func (*CommonRequest) Paginate

func (c *CommonRequest) Paginate()

func (*CommonRequest) SetDB

func (c *CommonRequest) SetDB(db *gorm.DB)

type Config

type Config struct {
	Name string //文件名称
	Path string //文件路径
	Ext  string //文件后缀
}

func (*Config) InitConfig

func (c *Config) InitConfig() error

type ConfigFn

type ConfigFn func(config *Config) *Config

func Ext

func Ext(ext string) ConfigFn

*@Author Administrator *@Date 25/4/2021 14:40 *@desc 文件后缀

func Name

func Name(name string) ConfigFn

*@Author Administrator *@Date 25/4/2021 14:36 *@desc 配置默认读取应用名字

func Path

func Path(path string) ConfigFn

*@Author Administrator *@Date 25/4/2021 14:39 *@desc 配置路径

type FileNameChange

type FileNameChange struct {
}

func (*FileNameChange) Camel2Case

func (f *FileNameChange) Camel2Case(name string) string

驼峰式写法转为下划线写法

func (*FileNameChange) Case2Camel

func (f *FileNameChange) Case2Camel(name string) string

下划线写法转为驼峰写法

func (*FileNameChange) Lcfirst

func (f *FileNameChange) Lcfirst(str string) string

首字母小写

func (*FileNameChange) Ucfirst

func (f *FileNameChange) Ucfirst(str string) string

首字母大写

type GormExt

type GormExt struct {
	DB          *gorm.DB
	I           interface{}
	Order       map[string]interface{}
	OrderString string
}

func (*GormExt) Init

func (g *GormExt) Init() *gorm.DB

type RouterFun

type RouterFun func(engine *gin.Engine)

Jump to

Keyboard shortcuts

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