generator

package module
v0.0.0-...-9d68316 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTableStruct

func GenerateTableStruct(db *gorm.DB, options ...Option)

Types

type FileNameHandler

type FileNameHandler func(tableName string) (fileName string)

type ModelNameHandler

type ModelNameHandler func(tableName string) (modelName string)

type Option

type Option func(config *option)

func GenTables

func GenTables(table ...string) Option

default: all

func WithFieldCoverable

func WithFieldCoverable(yes bool) Option

generate pointer when field has default value

func WithFieldNullable

func WithFieldNullable(yes bool) Option

func WithMapGoTypes

func WithMapGoTypes(mapTypes map[string]string) Option
【default】

"bool": { "bool" }, "tinyint": { "int8" }, "smallint": { "int16" }, "mediumint": { "int32" }, "bigint": { "int64" }, "int": { "int" },

func WithOutFileNameHandler

func WithOutFileNameHandler(handler FileNameHandler) Option

func WithOutFileSuffixName

func WithOutFileSuffixName(path string) Option

default: xxx.gen.go

func WithOutModelNameHandler

func WithOutModelNameHandler(handler ModelNameHandler) Option

func WithOutPath

func WithOutPath(path string) Option

default: ./model

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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