mdl

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFields added in v0.1.1

func CopyFields(src, dest interface{})

Copy equivalent fields from one interface{} to another Fields must have the same field names and the interfaces should be pointers to model-like structs

func CreateMarshalType added in v0.1.1

func CreateMarshalType(model interface{}, sch schema.Schema) interface{}

Creates a runtime type that has form, json, xml tags for marshalling to/from json By default uses the db name from the schema.

func ExtractModelIDs

func ExtractModelIDs(schema schema.Schema, anonModel interface{}) map[string]interface{}

func GetDBSchema

func GetDBSchema(model interface{}, db *gorm.DB) schema.Schema

func MapToModel added in v0.1.1

func MapToModel(inMap map[string]interface{}, model interface{}, sch schema.Schema)

Convert map to gorm Model

func MatchAllMapToModel

func MatchAllMapToModel(dataMap map[string]interface{}, schema schema.Schema) error

func MatchAnyMapToModel

func MatchAnyMapToModel(dataMap map[string]interface{}, schema schema.Schema) error

func ModelToMap added in v0.1.1

func ModelToMap(model interface{}, sch schema.Schema) map[string]interface{}

Convert gorm model to map

func New added in v0.1.1

func New(t interface{}) interface{}

func NewModel

func NewModel(model interface{}) interface{}

Types

type ColumnInfo added in v0.1.1

type ColumnInfo struct {
	DBName      string
	StructName  string
	Required    bool
	HasDefault  bool
	ColumnType  reflect.Type
	SchemaField *schema.Field
}

type ModelColumnInfo added in v0.1.1

type ModelColumnInfo map[string]ColumnInfo

func GetModelColumnInfo added in v0.1.1

func GetModelColumnInfo(model interface{}, db *gorm.DB) ModelColumnInfo

type StringSet

type StringSet map[string]bool

Jump to

Keyboard shortcuts

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