generator

package
v0.0.0-...-f8fad95 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const GoDAOGeneratorVersion = "v0.1"
View Source
const GoEntityGeneratorVersion = "v0.1"
View Source
const (
	MySQLGeneratorVersion = "v0.1"
)

Variables

View Source
var (
	DataTypeMap = map[string]string{
		"TYPE_FLOAT":         "FLOAT",
		"TYPE_DOUBLE":        "DOUBLE",
		"TYPE_INT32":         "INTEGER",
		"TYPE_INT64":         "BIGINT",
		"TYPE_UINT32":        "INTEGER UNSIGNED",
		"TYPE_UINT64":        "BIGINT UNSIGNED",
		"TYPE_SINT32":        "INTEGER",
		"TYPE_SINT64":        "BIGINT",
		"TYPE_FIXED32":       "INTEGER UNSIGNED",
		"TYPE_FIXED64":       "BIGINT UNSIGNED",
		"TYPE_SFIXED32":      "INTEGER",
		"TYPE_SFIXED64":      "BIGINT",
		"TYPE_BOOL":          "TINYINT(1)",
		"TYPE_BYTES":         "BLOB",
		"TYPE_STRING":        "VARCHAR",
		schema.TimestampType: "DATETIME",
	}
)
View Source
var (
	GoDataTypeMap = map[string]string{
		"TYPE_FLOAT":         "float32",
		"TYPE_DOUBLE":        "float64",
		"TYPE_INT32":         "int32",
		"TYPE_INT64":         "int64",
		"TYPE_UINT32":        "uint32",
		"TYPE_UINT64":        "uint64",
		"TYPE_SINT32":        "int",
		"TYPE_SINT64":        "int64",
		"TYPE_FIXED32":       "uint32",
		"TYPE_FIXED64":       "uint64",
		"TYPE_SFIXED32":      "int",
		"TYPE_SFIXED64":      "int64",
		"TYPE_BOOL":          "bool",
		"TYPE_BYTES":         "[]byte",
		"TYPE_STRING":        "string",
		schema.TimestampType: "time.Time",
	}
)

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	*bytes.Buffer
}

func (*Buffer) GoFormat

func (b *Buffer) GoFormat() ([]byte, error)

func (*Buffer) LineBreak

func (b *Buffer) LineBreak()

func (*Buffer) Write

func (b *Buffer) Write(s string)

func (*Buffer) WriteFunc

func (b *Buffer) WriteFunc(funcs ...*goFunc)

func (*Buffer) WriteInterface

func (b *Buffer) WriteInterface(funcs ...*goFunc)

func (*Buffer) Writef

func (b *Buffer) Writef(format string, a ...interface{})

type GoDAOGenerator

type GoDAOGenerator struct{}

func (GoDAOGenerator) Generate

func (g GoDAOGenerator) Generate(buf *bytes.Buffer, fileOpt *descriptorpb.FileOptions, messages *schema.Messages)

type GoDAOMockGenerator

type GoDAOMockGenerator struct{}

func (GoDAOMockGenerator) Generate

func (g GoDAOMockGenerator) Generate(buf *bytes.Buffer, fileOpt *descriptorpb.FileOptions, messages *schema.Messages, daoPath string)

type GoDAOStruct

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

func (*GoDAOStruct) Create

func (s *GoDAOStruct) Create(body func(m *schema.Message, f *goFunc) string) *goFunc

func (*GoDAOStruct) Delete

func (s *GoDAOStruct) Delete(body func(m *schema.Message, f *goFunc, where, whereArgs []string) string) *goFunc

func (*GoDAOStruct) PrimaryKeyMultiSelect

func (s *GoDAOStruct) PrimaryKeyMultiSelect(
	body func(entityPackageName string, m *schema.Message, args, where, whereArgs []string) string,
) *goFunc

func (*GoDAOStruct) PrimaryKeySelect

func (s *GoDAOStruct) PrimaryKeySelect(
	body func(entityPackageName string, m *schema.Message, args, where, whereArgs []string) string,
) *goFunc

func (*GoDAOStruct) Select

func (s *GoDAOStruct) Select(
	body func(m *schema.Message, name string, stmt *ast.SelectStmt, comp []*schema.Field, cols, args []string, entityName string, single bool) string,
) []*goFunc

func (*GoDAOStruct) Tx

func (s *GoDAOStruct) Tx(body func(m *schema.Message, f *goFunc) string) *goFunc

func (*GoDAOStruct) Update

func (s *GoDAOStruct) Update(body func(m *schema.Message, f *goFunc) string) *goFunc

type GoEntityGenerator

type GoEntityGenerator struct{}

func (GoEntityGenerator) Generate

func (GoEntityGenerator) Generate(buf *bytes.Buffer, fileOpt *descriptorpb.FileOptions, messages *schema.Messages)

type MySQLGenerator

type MySQLGenerator struct{}

func (MySQLGenerator) Generate

func (m MySQLGenerator) Generate(writer *bytes.Buffer, tables *schema.Messages)

type QueryFormatter

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

func NewQueryFormatter

func NewQueryFormatter(m *schema.Message, s ast.StmtNode) *QueryFormatter

func (*QueryFormatter) Format

func (f *QueryFormatter) Format(w io.Writer)

Jump to

Keyboard shortcuts

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