field

package
v0.0.0-...-70261f9 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagKeyGorm = "gorm"
	TagKeyJson = "json"

	//gorm tag
	TagKeyGormColumn        = "column"
	TagKeyGormType          = "type"
	TagKeyGormPrimaryKey    = "primaryKey"
	TagKeyGormAutoIncrement = "autoIncrement"
	TagKeyGormNotNull       = "not null"
	TagKeyGormUniqueIndex   = "uniqueIndex"
	TagKeyGormIndex         = "index"
	TagKeyGormDefault       = "default"
	TagKeyGormComment       = "comment"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldConfig

type FieldConfig struct {
	//gorm.ColumnType
	//TableName   string                                                        `gorm:"column:TABLE_NAME"`
	//Indexes     []*Index                                                      `gorm:"-"`
	UseScanType bool `gorm:"-"`

	DataTypeMap map[string]func(columnType gorm.ColumnType) (dataType string)

	FieldNullable     bool // generate pointer when field is nullable
	FieldCoverable    bool // generate pointer when field has default value
	FieldSignable     bool // detect integer field's unsigned type, adjust generated data type
	FieldWithIndexTag bool // generate with gorm index tag
	FieldWithTypeTag  bool // generate with gorm column type tag

	FieldNameNS    func(columnName string) string
	FieldJSONTagNS func(columnName string) string
	// contains filtered or unexported fields
}

func (*FieldConfig) SetDataTypeMap

func (c *FieldConfig) SetDataTypeMap(m map[string]func(columnType gorm.ColumnType) (dataType string))

SetDataTypeMap set data type map

func (*FieldConfig) WithNS

func (c *FieldConfig) WithNS(jsonTagNS func(columnName string) string)

WithNS with name strategy

type GormTag

type GormTag map[string][]string

func (GormTag) Append

func (tag GormTag) Append(key string, values ...string) GormTag

func (GormTag) Build

func (tag GormTag) Build() string

func (GormTag) Remove

func (tag GormTag) Remove(key string) GormTag

func (GormTag) Set

func (tag GormTag) Set(key string, values ...string) GormTag

type Tag

type Tag map[string]string

func (Tag) Build

func (tag Tag) Build() string

func (Tag) Remove

func (tag Tag) Remove(key string) Tag

func (Tag) Set

func (tag Tag) Set(key, value string) Tag

type TagBuilder

type TagBuilder interface {
	Build() string
}

Jump to

Keyboard shortcuts

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