schema

package
v0.0.0-...-7088f80 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FexORMTagName       = "fexorm"
	FexORMColumnNameTag = "COLUMN"
)

Variables

This section is empty.

Functions

func ParseTagSetting

func ParseTagSetting(tag string) map[string]string

Types

type Field

type Field struct {
	Name, Type, Tag, DBName string
}

type NamedTable

type NamedTable interface {
	TableName() string
}

type Schema

type Schema struct {
	Model      interface{}
	Name       string   // 结构体名称
	FieldNames []string // 结构体字段名
	Fields     []*Field

	Table        string   // 数据库表名,取自 TableName() 方法,兜底结构体名
	DBFieldNames []string // 数据库字段名,取自 COLUMN 标签,兜底字段名
	// contains filtered or unexported fields
}

Schema 利用反射完成 结构体和数据库表结构的映射

func Parse

func Parse(dest interface{}, d dialect.Dialect) *Schema

func (*Schema) GetFieldByName

func (schema *Schema) GetFieldByName(name string) *Field

func (*Schema) RecordValues

func (schema *Schema) RecordValues(dest interface{}) []interface{}

Jump to

Keyboard shortcuts

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