querybuilder2

package
v0.4.53 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSelectQueryMap

func BuildSelectQueryMap(
	driver string,
	tableFkConstraints map[string][]*sqlmanager_shared.ForeignConstraint,
	runConfigs []*tabledependency.RunConfig,
	subsetByForeignKeyConstraints bool,
	groupedColumnInfo map[string]map[string]*sqlmanager_shared.ColumnInfo,
) (map[string]map[tabledependency.RunType]string, error)

returns map of schema.table -> select query

Types

type AliasTableInfo

type AliasTableInfo struct {
	Name string
}

func (*AliasTableInfo) GetName

func (t *AliasTableInfo) GetName() string

func (*AliasTableInfo) GetSchema

func (t *AliasTableInfo) GetSchema() *string

type ForeignKey

type ForeignKey struct {
	Columns          []string
	ReferenceSchema  string
	ReferenceTable   string
	ReferenceColumns []string
}

type QueryBuilder

type QueryBuilder struct {
	// contains filtered or unexported fields
}

func NewQueryBuilder

func NewQueryBuilder(defaultSchema, driver string, subsetByForeignKeyConstraints bool, columnInfo map[string]map[string]*sqlmanager_shared.ColumnInfo) *QueryBuilder

func NewQueryBuilderFromSchemaDefinition

func NewQueryBuilderFromSchemaDefinition(
	groupedColumnInfo map[string]map[string]*sqlmanager_shared.ColumnInfo,
	tableDependencies map[string]*TableConstraints,
	defaultSchema string,
	driver string,
	subsetByForeignKeyConstraints bool,
) *QueryBuilder

func (*QueryBuilder) AddTable

func (qb *QueryBuilder) AddTable(table *TableInfo)

func (*QueryBuilder) AddWhereCondition

func (qb *QueryBuilder) AddWhereCondition(schema, tableName, condition string, args ...any)

func (*QueryBuilder) BuildQuery

func (qb *QueryBuilder) BuildQuery(schema, tableName string) (sqlstatement string, args []any, err error)

type TableConstraints

type TableConstraints struct {
	ForeignKeys []*sqlmanager_shared.ForeignConstraint
	PrimaryKeys []*sqlmanager_shared.PrimaryKey
}

type TableIdentity

type TableIdentity interface {
	GetSchema() *string
	GetName() string
}

type TableInfo

type TableInfo struct {
	Schema      string
	Name        string
	Columns     []string
	PrimaryKeys []string
	ForeignKeys []*ForeignKey
}

func (*TableInfo) GetIdentifierExpression

func (t *TableInfo) GetIdentifierExpression() exp.IdentifierExpression

func (*TableInfo) GetName

func (t *TableInfo) GetName() string

func (*TableInfo) GetSchema

func (t *TableInfo) GetSchema() *string

type WhereCondition

type WhereCondition struct {
	Condition string
	Args      []any
}

Jump to

Keyboard shortcuts

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