dbmeta

package
v0.0.0-...-e248b5d Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(dst interface{}, src interface{}) error

func FmtFieldName

func FmtFieldName(s string) string

fmtFieldName formats a string as a struct key

Example:

fmtFieldName("foo_id")

Output: FooID

Types

type FieldInfo

type FieldInfo struct {
	Name string
	Type string
	Tag  string
	Key  string
	Json string
}

type ModelInfo

type ModelInfo struct {
	ProjectName     string
	PackageName     string
	StructName      string
	ShortStructName string
	TableName       string
	Fields          []string
	FieldsInfo      []FieldInfo

	APIName string
}

func GenerateStruct

func GenerateStruct(db *sql.DB, projectName string, tableName string, structName string, pkgName string, jsonAnnotation bool, gormAnnotation bool, gureguTypes bool) *ModelInfo

GenerateStruct generates a struct for the given table.

Jump to

Keyboard shortcuts

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