base

package
v3.7.27 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config *config.Config
View Source
var Path string
View Source
var Query sql.SqlConn

Functions

func Add added in v3.2.16

func Add(numberOne, numberTwo any) int

func ApiToProto added in v3.2.31

func ApiToProto(Condition []Column, res, request string, page bool) string

func CamelStr added in v3.2.16

func CamelStr(name string) string

CamelStr 下划线转驼峰

func Char added in v3.2.16

func Char(in string) string

Char 对数据库参数进行编码

func Convert added in v3.2.16

func Convert(Condition []Column) string

函数转换

func GoInstall

func GoInstall(path ...string) error

GoInstall go get path.

func Helper added in v3.2.16

func Helper(name string) string

Helper 将驼峰的首字母小写

func InMethod added in v3.7.21

func InMethod(arr []Method, target ...string) bool

查询数组中是否包含某个元素

func InitBase added in v3.2.16

func InitBase() error

InitBase 初始化数据

func InitConfig added in v3.2.16

func InitConfig() error

InitConfig 初始化

func InitPath added in v3.2.16

func InitPath() error

InitPath 初始化路径

func InitQuery added in v3.2.16

func InitQuery() error

InitQuery 初始化数据查询

func Json added in v3.7.21

func Json(Condition []Column) string

func ModuleDaoConvertProto added in v3.2.31

func ModuleDaoConvertProto(Condition []Column, res, resItem string) string

ModuleDaoConvertProto 条件转换

func ModulePath

func ModulePath(filename string) (string, error)

ModulePath returns go module path.

func ModuleProtoConvertDao added in v3.2.31

func ModuleProtoConvertDao(Condition []Column, res, request string) string

ModuleProtoConvertDao 条件转换

func ModuleProtoConvertMap added in v3.2.31

func ModuleProtoConvertMap(Condition []Column, request string) string

ModuleProtoConvertMap 条件转换

func ModuleVersion

func ModuleVersion(path string) (string, error)

ModuleVersion returns module version.

func NewDataType added in v3.2.16

func NewDataType() map[string]DataType

func Pointer added in v3.6.4

func Pointer(in string) string

func Props added in v3.7.21

func Props(table, condition []Column) string

func ProtoRequest added in v3.6.0

func ProtoRequest(condition []Column) string

func RatelMod

func RatelMod() string

RatelMod returns ratel mod.

func Rule added in v3.7.21

func Rule(table []Column) string

func SymbolChar added in v3.2.16

func SymbolChar() string

SymbolChar 模板变量函数

func Tree

func Tree(path string, dir string)

func TypeScript added in v3.7.21

func TypeScript(Condition []Column) string

TypeScript 条件转换

func TypeScriptCondition added in v3.7.21

func TypeScriptCondition(Condition []Column) string

Types

type Column added in v3.2.16

type Column struct {
	ColumnName      string   `db:"COLUMN_NAME"`    // 字段名
	IsNullable      string   `db:"IS_NULLABLE"`    // 是否为空
	DataType        string   `db:"DATA_TYPE"`      // 字段类型
	ColumnKey       string   `db:"COLUMN_KEY"`     // 是否索引
	ColumnComment   string   `db:"COLUMN_COMMENT"` // 字段描述
	PosiTion        int64    // 排序信息
	DataTypeMap     DataType // 字段类型信息
	AlisaColumnName string   // 字段名
}

Column 字段新

func TableColumn added in v3.2.16

func TableColumn(ctx context.Context, DbName, TableName string) ([]Column, error)

TableColumn 获取数据中表中字段的信息

func TablePrimary added in v3.2.16

func TablePrimary(ctx context.Context, DbName, TableName string) (Column, error)

TablePrimary 获取主键

type DaoParam added in v3.2.16

type DaoParam struct {
	Table       Table
	TableColumn []Column
}

type DataType added in v3.2.16

type DataType struct {
	Default     string // 不空时
	Empty       string // 为空时
	Proto       string // Grpc 协议
	OptionProto bool   // Grpc 协议
	TypeScript  string // TypeScript
	Json        string // Json
}

DataType 字段类型信息

type Index added in v3.2.16

type Index struct {
	IndexName string `db:"INDEX_NAME"` // 索引名称
	Field     string `db:"FIELD"`      // 索引作用字段
}

Index 索引信息

func TableIndex added in v3.2.16

func TableIndex(ctx context.Context, DbName, TableName string) ([]Index, error)

TableIndex 获取表的索引信息

type Method added in v3.2.16

type Method struct {
	Type           string   // 方法类型(List多个/Item单条/Create新增/Update修改/Delete删除/Only单个)
	Name           string   // 函数名称
	Alias          string   // 函数别名
	Condition      []Column // 函数需要的条件信息
	ConditionTotal int      // 条件数量
	Table          Table    // 表信息
	TableColumn    []Column // 表结构信息
	Pkg            string   // 包名
	PkgPath        string   // 包名路径
	Primary        Column   // 主键信息
	ModName        string   // go.mod 信息
	Page           bool     // 是否分页
	SoftDelete     bool     // 是否删除
}

Method 构造的函数

type ModuleParam added in v3.2.16

type ModuleParam struct {
	Table       Table
	TableColumn []Column
	Method      []Method // 方法
	Pkg         string   // 包名
	PkgPath     string   // 包名路径
	Primary     Column   // 主键信息
	ModName     string   // go.mod 信息
	Page        bool     // 是否分页
	SoftDelete  bool     // 是否删除
	Condition   []Column // 函数需要的条件信息
}

type Repo

type Repo struct {
	// contains filtered or unexported fields
}

Repo is git repository manager.

func NewRepo

func NewRepo(url string, branch string) *Repo

NewRepo new a repository manager.

func (*Repo) Clone

func (r *Repo) Clone(ctx context.Context) error

Clone clones the repository to cache path.

func (*Repo) CopyFrontTo added in v3.5.3

func (r *Repo) CopyFrontTo(ctx context.Context, to string, modPath string, ignores []string) error

CopyTo copies the repository to project path.

func (*Repo) CopyTo

func (r *Repo) CopyTo(ctx context.Context, to string, modPath string, ignores []string) error

CopyTo copies the repository to project path.

func (*Repo) CopyToV2

func (r *Repo) CopyToV2(ctx context.Context, to string, modPath string, ignores, replaces []string) error

CopyToV2 copies the repository to project path

func (*Repo) Path

func (r *Repo) Path() string

Path returns the repository cache path.

func (*Repo) Pull

func (r *Repo) Pull(ctx context.Context) error

Pull fetch the repository from remote url.

type Table added in v3.2.16

type Table struct {
	TableName    string `db:"TABLE_NAME"`    // 表名
	TableComment string `db:"TABLE_COMMENT"` // 表注释
}

Table 表信息

func TableItem added in v3.2.16

func TableItem(ctx context.Context, DbName, TableName string) (Table, error)

TableItem 获取数据中表的信息

func TableList added in v3.2.16

func TableList(ctx context.Context, DbName string) ([]Table, error)

TableList 获取数据中表的信息

Jump to

Keyboard shortcuts

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