metadata

package
v1.0.0-RC9 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Models map[string]GoedbTable

Models contains every model migrated

Functions

func GetGoedbTagTypeAndValue

func GetGoedbTagTypeAndValue(instanceType reflect.Type, instanceValue reflect.Value, goedbTag string) (reflect.Type, reflect.Value, error)

GetGoedbTagTypeAndValue returns the tag and the value of a struct

func GetGoedbTagTypeAndValueOfIndexField

func GetGoedbTagTypeAndValueOfIndexField(instanceType reflect.Type, instanceValue reflect.Value, goedbTag string, fieldID int) (reflect.Type, reflect.Value, error)

GetGoedbTagTypeAndValueOfIndexField returns the type and the value of a index field

func GetType

func GetType(i interface{}) reflect.Type

GetType returns the type of a struct

func GetValue

func GetValue(i interface{}) reflect.Value

GetValue returns the value of a struct

func StructToSliceOfAddresses

func StructToSliceOfAddresses(structPtr interface{}) []interface{}

StructToSliceOfAddresses returns a slice with the addresses of each struct field, so any modification on the slide will modify the source struct fields

func StructToSliceOfAddressesWithRules

func StructToSliceOfAddressesWithRules(structPtr interface{}) []interface{}

StructToSliceOfAddressesWithRules returns a slice with the addresses of each struct field, so any modification on the slide will modify the source struct fields

Types

type GoedbColumn

type GoedbColumn struct {
	Title               string
	ColumnType          reflect.Kind
	ColumnTypeName      string
	PrimaryKey          bool
	Unique              bool
	ForeignKey          bool
	ForeignKeyReference string
	AutoIncrement       bool
	IsComplex           bool
	Ignore              bool
}

GoedbColumn represents the metadata of a column

type GoedbTable

type GoedbTable struct {
	Name           string
	Columns        []GoedbColumn
	PrimaryKeyName string       `json:"-"`
	PrimaryKeyType reflect.Kind `json:"-"`
}

GoedbTable represents the metadata of a table

func ParseModel

func ParseModel(entity interface{}) GoedbTable

ParseModel generates a GoedbTable, the model of a struct

Jump to

Keyboard shortcuts

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