metadata

package
v0.0.0-...-894d565 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: Apache-2.0, BSD-3-Clause, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Name         string
	IsPrimaryKey bool
	IsNullable   bool
	IsGenerated  bool
	DataType     DataType
	Comment      string
}

Column struct

type DataType

type DataType struct {
	Name       string
	Kind       DataTypeKind
	IsUnsigned bool
}

DataType contains information about column data type

type DataTypeKind

type DataTypeKind string

DataTypeKind is database type kind(base, enum, user-defined, array)

const (
	BaseType        DataTypeKind = "base"
	EnumType        DataTypeKind = "enum"
	UserDefinedType DataTypeKind = "user-defined"
	ArrayType       DataTypeKind = "array"
)

DataTypeKind possible values

type DialectQuerySet

type DialectQuerySet interface {
	GetTablesMetaData(db *sql.DB, schemaName string, tableType TableType) []Table
	GetEnumsMetaData(db *sql.DB, schemaName string) []Enum
}

DialectQuerySet is set of methods necessary to retrieve dialect meta data information

type Enum

type Enum struct {
	Name   string `sql:"primary_key"`
	Values []string
}

Enum metadata struct

type Schema

type Schema struct {
	Name           string
	TablesMetaData []Table
	ViewsMetaData  []Table
	EnumsMetaData  []Enum
}

Schema struct

func GetSchema

func GetSchema(db *sql.DB, querySet DialectQuerySet, schemaName string) Schema

GetSchema retrieves Schema information from database

func (Schema) IsEmpty

func (s Schema) IsEmpty() bool

IsEmpty returns true if schema info does not contain any table, views or enums metadata

type Table

type Table struct {
	Name    string
	Columns []Column
}

Table metadata struct

func (Table) MutableColumns

func (t Table) MutableColumns() []Column

MutableColumns returns list of mutable columns for table

type TableType

type TableType string

TableType is type of database table(view or base)

const (
	BaseTable TableType = "BASE TABLE"
	ViewTable TableType = "VIEW"
)

SQL table types

Jump to

Keyboard shortcuts

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