Help us shape the future of Go! Take the 2026 Go Developer Survey

sdata

package
v0.21.9 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFromEdgeNotFound   = errors.New("from edge not found")
	ErrToEdgeNotFound     = errors.New("to edge not found")
	ErrPathNotFound       = errors.New("path not found")
	ErrThoughNodeNotFound = errors.New("though node not found")
)

Functions

This section is empty.

Types

type DBColumn

type DBColumn struct {
	ID         int32
	Name       string
	Type       string
	Array      bool
	NotNull    bool
	PrimaryKey bool
	UniqueKey  bool
	FullText   bool
	FKeySchema string
	FKeyTable  string
	FKeyCol    string
	Blocked    bool
	Table      string
	Schema     string
}

func DiscoverColumns added in v0.15.70

func DiscoverColumns(db *sql.DB, dbtype string, blockList []string) ([]DBColumn, error)

func (DBColumn) String

func (col DBColumn) String() string

type DBFuncParam

type DBFuncParam struct {
	ID      int
	Name    string
	Type    string
	IsArray bool
}

type DBFunction

type DBFunction struct {
	Schema  string
	Name    string
	Type    string
	Agg     bool
	Inputs  []DBFuncParam
	Outputs []DBFuncParam
}

func DiscoverFunctions added in v0.15.70

func DiscoverFunctions(db *sql.DB, dbtype string, blockList []string) ([]DBFunction, error)

func (*DBFunction) GetInput added in v0.21.9

func (fn *DBFunction) GetInput(name string) (ret DBFuncParam, err error)

type DBInfo

type DBInfo struct {
	Type    string
	Version int
	Schema  string
	Name    string

	Tables    []DBTable      `hash:"set"`
	Functions []DBFunction   `hash:"set"`
	VTables   []VirtualTable `hash:"set"`
	// contains filtered or unexported fields
}

func GetDBInfo

func GetDBInfo(
	db *sql.DB,
	dbType string,
	blockList []string) (*DBInfo, error)

func GetTestDBInfo

func GetTestDBInfo() *DBInfo

func NewDBInfo added in v0.15.70

func NewDBInfo(
	dbType string,
	dbVersion int,
	dbSchema string,
	dbName string,
	cols []DBColumn,
	funcs []DBFunction,
	blockList []string) *DBInfo

func (*DBInfo) AddTable

func (di *DBInfo) AddTable(t DBTable)

func (*DBInfo) GetColumn

func (di *DBInfo) GetColumn(schema, table, column string) (*DBColumn, error)

func (*DBInfo) GetTable added in v0.15.70

func (di *DBInfo) GetTable(schema, table string) (*DBTable, error)

func (*DBInfo) Hash added in v0.16.104

func (di *DBInfo) Hash() uint64

type DBRel

type DBRel struct {
	Type  RelType
	Left  DBRelLeft
	Right DBRelRight
}

func PathToRel added in v0.15.70

func PathToRel(p TPath) DBRel

func (*DBRel) String

func (re *DBRel) String() string

type DBRelLeft added in v0.15.63

type DBRelLeft struct {
	Ti  DBTable
	Col DBColumn
}

type DBRelRight added in v0.15.63

type DBRelRight struct {
	VTable string
	Ti     DBTable
	Col    DBColumn
}

type DBSchema

type DBSchema struct {
	SingularSuffix string // singular suffix
	// contains filtered or unexported fields
}

func GetTestSchema

func GetTestSchema() (*DBSchema, error)

func NewDBSchema

func NewDBSchema(
	info *DBInfo,
	aliases map[string][]string) (*DBSchema, error)

func (*DBSchema) DBName added in v0.15.84

func (s *DBSchema) DBName() string

func (*DBSchema) DBSchema added in v0.15.84

func (s *DBSchema) DBSchema() string

func (*DBSchema) DBType added in v0.15.84

func (s *DBSchema) DBType() string

func (*DBSchema) DBVersion

func (s *DBSchema) DBVersion() int

func (*DBSchema) Find added in v0.15.70

func (s *DBSchema) Find(schema, name string) (DBTable, error)

func (*DBSchema) FindPath added in v0.15.70

func (s *DBSchema) FindPath(from, to, through string) ([]TPath, error)

func (*DBSchema) GetAliases added in v0.15.50

func (s *DBSchema) GetAliases() map[string]DBTable

func (*DBSchema) GetFirstDegree added in v0.16.27

func (s *DBSchema) GetFirstDegree(schema, table string) (map[string]DBTable, error)

func (*DBSchema) GetFunctions

func (s *DBSchema) GetFunctions() map[string]DBFunction

func (*DBSchema) GetSecondDegree added in v0.16.27

func (s *DBSchema) GetSecondDegree(schema, table string) (map[string]DBTable, error)

func (*DBSchema) GetTables added in v0.15.80

func (s *DBSchema) GetTables() []DBTable

func (*DBSchema) IsAlias added in v0.16.9

func (s *DBSchema) IsAlias(name string) bool

func (*DBSchema) PrintEdgeInfo added in v0.20.0

func (s *DBSchema) PrintEdgeInfo(e edgeInfo)

func (*DBSchema) PrintLines added in v0.20.0

func (s *DBSchema) PrintLines(lines []util.Edge)

type DBTable

type DBTable struct {
	Schema       string
	Name         string
	Type         string
	Columns      []DBColumn `hash:"set"`
	PrimaryCol   DBColumn
	SecondaryCol DBColumn
	FullText     []DBColumn `hash:"set"`
	Blocked      bool
	Func         DBFunction
	// contains filtered or unexported fields
}

func NewDBTable added in v0.15.70

func NewDBTable(schema, name, _type string, cols []DBColumn) DBTable

func (*DBTable) ColumnExists added in v0.17.16

func (ti *DBTable) ColumnExists(name string) (DBColumn, bool)

func (*DBTable) GetColumn added in v0.15.70

func (ti *DBTable) GetColumn(name string) (DBColumn, error)

func (*DBTable) String added in v0.15.70

func (ti *DBTable) String() string

type RelType

type RelType int
const (
	RelNone RelType = iota
	RelOneToOne
	RelOneToMany
	RelPolymorphic
	RelRecursive
	RelEmbedded
	RelRemote
	RelSkip
)

func (RelType) String

func (i RelType) String() string

type TEdge added in v0.15.70

type TEdge struct {
	From, To, Weight int32

	Type   RelType
	LT, RT DBTable
	L, R   DBColumn
	CName  string
	// contains filtered or unexported fields
}

type TPath added in v0.15.70

type TPath struct {
	Rel RelType
	LT  DBTable
	LC  DBColumn
	RT  DBTable
	RC  DBColumn
}

type VirtualTable

type VirtualTable struct {
	Name       string
	IDColumn   string
	TypeColumn string
	FKeyColumn string
}

Jump to

Keyboard shortcuts

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