types

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FK_NONE = iota
	FK_RELATION_ONE_MANY
	FK_RELATION_ONE_ONE
	FK_RELATION_MANY_ONE
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FKRelation

type FKRelation = int8

type Field

type Field struct {
	// desc      *descriptor.FieldDescriptorProto
	Table   *Table
	ColName string
	Type    string
	MsgName string
	PK      sqlgen.PK

	// dbfk      string
	DbfkField  string
	DbfkTable  string
	FK         FieldFK
	Order      int
	Repeated   bool
	IsMessage  bool
	Extensions map[string]interface{}
	Column     sqlgen.Column
	// contains filtered or unexported fields
}

func (*Field) AddForeignKey

func (f *Field) AddForeignKey(tm *TableMessages, table string, field string)

type FieldFK

type FieldFK struct {
	// message  *generator.Descriptor
	Remote   *Field
	Relation FKRelation
}

type Table

type Table struct {
	GoPackageName   string
	GoPackageImport string
	Engine          string
	StoreName       string
	Name            string
	MsgName         string
	// desc   *generator.Descriptor
	Cols   map[string]*Field
	JSONB  bool
	Create bool
	Read   bool
	Update bool
	Delete bool

	Imports map[string]string
}

func (*Table) GetColumnByColumnName

func (tm *Table) GetColumnByColumnName(message string) (*Field, bool)

func (*Table) GetColumnByMessageName

func (tm *Table) GetColumnByMessageName(message string) (*Field, bool)

func (*Table) GetOrderedCols

func (t *Table) GetOrderedCols() []*Field

func (Table) GetPKs

func (m Table) GetPKs() []*Field

type TableMessages

type TableMessages struct {
	MessageTables map[string]*Table
}

func (*TableMessages) GetTableByMessageName

func (tm *TableMessages) GetTableByMessageName(tableName string) (*Table, bool)

func (*TableMessages) GetTableByTableName

func (tm *TableMessages) GetTableByTableName(tableName string) (*Table, bool)

func (*TableMessages) GetTablesByStoreName

func (tm *TableMessages) GetTablesByStoreName(storeName string) []*Table

Jump to

Keyboard shortcuts

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