parser

package
v0.0.0-...-03ad30d Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Camel2Case

func Camel2Case(name string) string

************************************** 其他方法 ************************************** 驼峰式写法转为下划线写法

func CamelString

func CamelString(s string) string

*

  • 蛇形转驼峰
  • @description xx_yy to XxYx xx_y_y to XxYY
  • @date 2020/7/30
  • @param s要转换的字符串
  • @return string *

func Case2Camel

func Case2Camel(name string) string

下划线写法转为驼峰写法

func GetCreateTableFromDB

func GetCreateTableFromDB(dsn, tableName string) (string, error)

func Lcfirst

func Lcfirst(str string) string

首字母小写

func ParseSqlToWrite

func ParseSqlToWrite(sql string, writer io.Writer, options ...Option) error

func SnakeString

func SnakeString(s string) string

*

  • 驼峰转蛇形 snake string
  • @description XxYy to xx_yy , XxYY to xx_y_y
  • @date 2020/7/30
  • @param s 需要转换的字符串
  • @return string *

func Ucfirst

func Ucfirst(str string) string

首字母大写

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 JsonCamelCase

type JsonCamelCase struct {
	Value interface{}
}

************************************** 驼峰json **************************************

func (JsonCamelCase) MarshalJSON

func (c JsonCamelCase) MarshalJSON() ([]byte, error)

type JsonSnakeCase

type JsonSnakeCase struct {
	Value interface{}
}

************************************** 下划线json **************************************

func (JsonSnakeCase) MarshalJSON

func (c JsonSnakeCase) MarshalJSON() ([]byte, error)

type ModelCodes

type ModelCodes struct {
	Package    string
	ImportPath []string
	StructCode []string
}

func ParseSql

func ParseSql(sql string, options ...Option) (ModelCodes, error)

func ParseSqlFromDB

func ParseSqlFromDB(dsn, tableName string, options ...Option) (ModelCodes, error)

type NullStyle

type NullStyle int
const (
	NullDisable NullStyle = iota
	NullInSql
	NullInPointer
)

type Option

type Option func(*options)

func WithCharset

func WithCharset(charset string) Option

func WithCollation

func WithCollation(collation string) Option

func WithColumnPrefix

func WithColumnPrefix(p string) Option

func WithDbTag

func WithDbTag() Option

func WithForceTableName

func WithForceTableName() Option

func WithGormType

func WithGormType() Option

WithGormType will write type in gorm tag

func WithJsonTag

func WithJsonTag() Option

func WithNoNullType

func WithNoNullType() Option

func WithNullStyle

func WithNullStyle(s NullStyle) Option

func WithPackage

func WithPackage(pkg string) Option

func WithTablePrefix

func WithTablePrefix(p string) Option

Jump to

Keyboard shortcuts

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