postgresmeta

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: Apache-2.0, BSD-3-Clause, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnInfo

type ColumnInfo struct {
	Name       string
	IsNullable bool
	DataType   string
	EnumName   string
}

ColumnInfo metadata struct

func (ColumnInfo) GoBaseType

func (c ColumnInfo) GoBaseType() string

GoBaseType returns model type for column info.

func (ColumnInfo) GoModelTag

func (c ColumnInfo) GoModelTag(isPrimaryKey bool) string

GoModelTag returns model field tag for column

func (ColumnInfo) GoModelType

func (c ColumnInfo) GoModelType() string

GoModelType returns model type for column info with optional pointer if column can be NULL.

func (ColumnInfo) SqlBuilderColumnType

func (c ColumnInfo) SqlBuilderColumnType() string

SqlBuilderColumnType returns type of jet sql builder column

type EnumInfo

type EnumInfo struct {
	Values []string
	// contains filtered or unexported fields
}

EnumInfo struct

func (EnumInfo) Name

func (e EnumInfo) Name() string

Name returns enum name

type SchemaInfo

type SchemaInfo struct {
	DatabaseName string
	Name         string
	TableInfos   []metadata.MetaData
	EnumInfos    []metadata.MetaData
}

SchemaInfo metadata struct

func GetSchemaInfo

func GetSchemaInfo(db *sql.DB, databaseName, schemaName string) (schemaInfo SchemaInfo, err error)

GetSchemaInfo returns schema information from db connection.

type TableInfo

type TableInfo struct {
	SchemaName string

	PrimaryKeys map[string]bool
	Columns     []ColumnInfo
	// contains filtered or unexported fields
}

TableInfo metadata struct

func GetTableInfo

func GetTableInfo(db *sql.DB, dbName, schemaName, tableName string) (tableInfo TableInfo, err error)

GetTableInfo returns table info metadata

func (TableInfo) GetImports

func (t TableInfo) GetImports() []string

GetImports returns model imports for table.

func (TableInfo) GoStructName

func (t TableInfo) GoStructName() string

GoStructName returns go struct name for sql builder

func (TableInfo) IsPrimaryKey

func (t TableInfo) IsPrimaryKey(column string) bool

IsPrimaryKey returns if column is a part of primary key

func (TableInfo) MutableColumns

func (t TableInfo) MutableColumns() []ColumnInfo

MutableColumns returns list of mutable columns for table

func (TableInfo) Name

func (t TableInfo) Name() string

Name returns table info name

Jump to

Keyboard shortcuts

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