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

types

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionTypeCreate ActionType = "CREATE"
	ActionTypeDrop   ActionType = "DROP"

	EntityTypeSchema     EntityType = "SCHEMA"
	EntityTypeTable      EntityType = "TABLE"
	EntityTypeColumn     EntityType = "COLUMN"
	EntityTypeConstraint EntityType = "CONST"
	EntityTypeView       EntityType = "VIEW"
	EntityTypeSequence   EntityType = "SEQ"

	StateTagCS StateTag = "CS"
	StateTagPS StateTag = "PS"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionType

type ActionType string

type CobraCmdFn

type CobraCmdFn = func(cmd *cobra.Command, args []string)

type Column

type Column struct {
	TableSchema      string
	TableName        string
	Name             string
	Default          string
	Nullable         bool
	DataType         string
	CharMaxLen       int
	NumericPrecision int
	NumericScale     int
}

type ConnConfig added in v0.5.1

type ConnConfig struct {
	User     string            `json:"user"`
	Driver   string            `json:"driver"`
	Password string            `json:"password"`
	Host     string            `json:"host"`
	Port     string            `json:"port"`
	Database string            `json:"dbname"`
	Params   map[string]string `json:"params"`
}

func NewDefaultPgConnConfig added in v0.5.1

func NewDefaultPgConnConfig() ConnConfig

type DbConfigOrigins added in v0.5.1

type DbConfigOrigins = map[string]ConnConfig

type DbConstraint

type DbConstraint struct {
	// on table
	TableSchema string
	TableName   string
	ColName     string

	ConName          string
	ConSchema        string
	Type             string // can be 'p', 'f', 'c' or 'u'
	UpdateActionType string
	DeleteActionType string

	// foreign table
	FTableSchema string
	FTableName   string
	FColName     string

	Syntax string
}

type DbDumpFilesMap

type DbDumpFilesMap = map[string][]string

type DbRow

type DbRow struct {
	DataType string
	Value    interface{}
}

type DbRows

type DbRows = map[string][]DbRow

type DbSchema

type DbSchema struct {
	DbName    string
	Tables    map[string]*TableSchema
	Views     map[string]*TableSchema
	Types     []DbType
	Schemas   []Schema
	Sequences []DbSequence
}

the string key is of format "schema.table"

type DbSequence

type DbSequence struct {
	Schema      string
	Name        string
	DataType    string
	IncrementBy int
	MinValue    int
	MaxValue    int
	StartValue  int
	CacheSize   int
	Cycle       bool
}

type DbType

type DbType struct {
	Schema string
	Name   string
}

type DiffKey

type DiffKey struct {
	Entity   Entity
	StateTag StateTag
}

type Entity

type Entity struct {
	Type EntityType
	Id   []string

	// pointer to the real entity
	Ptr interface{}
}

func NewEntity

func NewEntity(entityType EntityType, entityPtr interface{}) Entity

func (*Entity) GetEntityId

func (e *Entity) GetEntityId() []string

type EntityType

type EntityType string

type MiddlewareFunc

type MiddlewareFunc = func(fn CobraCmdFn) CobraCmdFn

type MigAction

type MigAction struct {
	ActionType ActionType
	StateTag   StateTag
	Entity     Entity

	/*
		For table, dep id is "schema.table", for col it's "schema.table.colname", for constraint/type it's "schema.name"
	*/
	DepArr []string
}

type QueryResult

type QueryResult struct {
	RowCount uint
	Data     DbRows
	Columns  []string
}

type Response

type Response struct {
	Message string
	Data    any
}

type SafeVar

type SafeVar[T any] struct {
	// contains filtered or unexported fields
}

func NewSafeVar

func NewSafeVar[T any](val T) SafeVar[T]

func (*SafeVar[T]) Get

func (s *SafeVar[T]) Get() T

func (*SafeVar[T]) Set

func (s *SafeVar[T]) Set(newVal T)

type Schema

type Schema struct {
	Name string
}

type StateTag

type StateTag string

type Table

type Table struct {
	Schema string
	Name   string

	// IMP: possible values to be put in from constants 'TableType*'
	Type string
}

type TableSchema

type TableSchema struct {
	Schema      string
	Name        string
	DefSyntax   string // populated for only views
	Columns     []Column
	Constraints []*DbConstraint
}

Jump to

Keyboard shortcuts

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