metamodel

package
v0.1.40 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Bool       = Primitive("bool")
	Int        = Primitive("int")
	Int8       = Primitive("int8")
	Int16      = Primitive("int16")
	Int32      = Primitive("int32")
	Int64      = Primitive("int64")
	Uint       = Primitive("uint")
	Uint8      = Primitive("uint8")
	Byte       = Primitive("byte")
	Uint16     = Primitive("uint16")
	Uint32     = Primitive("uint32")
	Uint64     = Primitive("uint64")
	Uintptr    = Primitive("uintptr")
	Float32    = Primitive("float32")
	Float64    = Primitive("float64")
	Complex64  = Primitive("complex64")
	Complex128 = Primitive("complex128")
	String     = Primitive("string")
)
View Source
var DefaultFS embed.FS

Functions

This section is empty.

Types

type ArrayType

type ArrayType struct {
	Element Type
	Basic
}

func (*ArrayType) GetPostgresSerialType

func (at *ArrayType) GetPostgresSerialType() string

func (*ArrayType) GetPostgresType

func (at *ArrayType) GetPostgresType() string

type Basic

type Basic struct {
	GoType             GoType
	Name               string
	PostgresType       string
	PostgresSerialType string
	Annotations        []string
}

func (*Basic) GetAnnotations

func (b *Basic) GetAnnotations() []string

func (*Basic) GetGoType

func (b *Basic) GetGoType() GoType

type EmbedType

type EmbedType struct {
	Fields []*StructField
	Basic
}

func (*EmbedType) GetPostgresSerialType

func (et *EmbedType) GetPostgresSerialType() string

func (*EmbedType) GetPostgresType

func (et *EmbedType) GetPostgresType() string

type GoType

type GoType interface {
	Elem() GoType
	Key() GoType
	Name(buf *bytes.Buffer)
	PkgPath() string
	String() string
	Variant() Variant
	// contains filtered or unexported methods
}

func MapOf

func MapOf(key, elem GoType) GoType

func PointerTo

func PointerTo(elem GoType) GoType

func Primitive

func Primitive(name string) GoType

func SliceOf

func SliceOf(elem GoType) GoType

func StructOf

func StructOf(pkg, name string) GoType

type MapType

type MapType struct {
	Key   Type
	Value Type
	Basic
}

func (*MapType) GetPostgresSerialType

func (mt *MapType) GetPostgresSerialType() string

func (*MapType) GetPostgresType

func (mt *MapType) GetPostgresType() string

type Model

type Model struct {
	Primitives []*PrimitiveType
	Arrays     []*ArrayType
	Maps       []*MapType
	Structs    []*StructType
}

func (*Model) Load

func (model *Model) Load(modelFS fs.FS) error

type PrimitiveType

type PrimitiveType struct {
	Basic `yaml:",inline"`
}

func (*PrimitiveType) GetPostgresSerialType

func (pt *PrimitiveType) GetPostgresSerialType() string

func (*PrimitiveType) GetPostgresType

func (pt *PrimitiveType) GetPostgresType() string

type StructField

type StructField struct {
	Type        Type
	Name        string
	Annotations []string
	NotNull     bool
	ReadOnly    bool
	Serial      bool
}

type StructType

type StructType struct {
	Fields     []*StructField
	PrimaryKey []*StructField
	Uniques    [][]*StructField
	Basic
}

func (*StructType) GetPostgresSerialType

func (st *StructType) GetPostgresSerialType() string

func (*StructType) GetPostgresType

func (st *StructType) GetPostgresType() string

type Type

type Type interface {
	GetAnnotations() []string
	GetGoType() GoType
	GetPostgresSerialType() string
	GetPostgresType() string
	// contains filtered or unexported methods
}

type Variant

type Variant int
const (
	VariantInvalid Variant = iota
	VariantBasic
	VariantPointer
	VariantSlice
	VariantMap
	VariantStruct
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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