base

package
v2.9.9 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 23 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 *query.Query

Functions

func Add

func Add(numberOne, numberTwo interface{}) int

func CamelStr

func CamelStr(name string) string

CamelStr 下划线转驼峰

func Char

func Char(in string) string

Char 对数据库参数进行编码

func Convert

func Convert(Condition []Column) string

函数转换

func GoInstall

func GoInstall(path ...string) error

GoInstall go get path.

func Helper

func Helper(name string) string

Helper 将驼峰的首字母小写

func InitBase

func InitBase() error

InitBase 初始化数据

func InitConfig

func InitConfig() error

InitConfig 初始化

func InitPath

func InitPath() error

InitPath 初始化路径

func InitQuery

func InitQuery() error

InitQuery 初始化数据查询

func ModulePath

func ModulePath(filename string) (string, error)

ModulePath returns go module path.

func ModuleVersion

func ModuleVersion(path string) (string, error)

ModuleVersion returns module version.

func NewDataType

func NewDataType() map[string]DataType

func RatelMod

func RatelMod() string

RatelMod returns ratel mod.

func SymbolChar

func SymbolChar() string

SymbolChar 模板变量函数

func Tree

func Tree(path string, dir string)

Types

type Column

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 // 字段类型信息
}

Column 字段新

func TableColumn

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

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

func TablePrimary

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

TablePrimary 获取主键

type DaoParam

type DaoParam struct {
	Table       Table
	TableColumn []Column
}

type DataType

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

DataType 字段类型信息

type Index

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

Index 索引信息

func TableIndex

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

TableIndex 获取表的索引信息

type Method

type Method struct {
	Type           string   // 方法类型(list多个/one单条)
	Name           string   // 函数名称
	Condition      []Column // 函数需要的条件信息
	ConditionTotal int      // 条件数量
	Table          Table    // 表信息
	TableColumn    []Column // 表结构信息
	Default        bool     // 默认
	Primary        Column   // 主键信息
}

Method 构造的函数

type ModuleParam

type ModuleParam struct {
	Table       Table
	TableColumn []Column
	Method      []Method // 方法
	Pkg         string   // 包名
	Primary     Column   // 主键信息
	ModName     string   // go.mod 信息
}

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) 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

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

Table 表信息

func TableItem

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

TableItem 获取数据中表的信息

func TableList

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