database

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FilterNumericField = "FilterNumericField"
	FilterStringField  = "FilterStringField"
	FilterArrayField   = "FilterArrayField"
	FilterGenericField = "FilterGenericField"
)

Variables

This section is empty.

Functions

func Generate

func Generate(schema *core.SQLSchema, contents io.Writer, pkg string, driver string, logger string) error

func GetNormalizedTypeFilter

func GetNormalizedTypeFilter(col *PostgresColumn) string

Types

type FieldInitializer

type FieldInitializer struct {
	Import string
	Init   string
	Type   string
	Match  string
}

type FilterMethod

type FilterMethod struct {
	Name    string
	Filters []SelectFilter
}

func GetFilterMethods

func GetFilterMethods(tables []*PostgresTable, driver string) []FilterMethod

type HeaderData

type HeaderData struct {
	Package     string
	Url         string
	Date        string
	Version     string
	Deps        []string
	Placeholder string
}

type LoggerConfig

type LoggerConfig struct {
	HasLoggerParam bool
	HasLogger      bool
	Type           string
}

type PostgresColumn

type PostgresColumn struct {
	Name           string
	NameNormalized string
	NameJson       string
	Type           string
	TypeSql        string
	Nullable       bool
	IsArray        bool
	HasDefault     bool
}

type PostgresCtx

type PostgresCtx struct {
	Const string
}

type PostgresQuery

type PostgresQuery struct {
	Name           string
	NameNormalized string
	Method         string
	Fields         []*PostgresColumn
	SqlQuery       string

	Select         string
	SelectOriginal string
	From           string
	Where          string
	GroupBy        []string
	Having         string
}

type PostgresTable

type PostgresTable struct {
	Name               string
	NameNormalized     string
	HasCompositeId     bool
	HasIdAutoGenerated bool
	ColumnIds          []*PostgresColumn
	Columns            []*PostgresColumn
	ColumnsCreate      []*PostgresColumn
	ColumnsUpdate      []*PostgresColumn
	Primary            []string
	// contains filtered or unexported fields
}

func (*PostgresTable) GetCreateManySqlContent

func (table *PostgresTable) GetCreateManySqlContent() string

func (*PostgresTable) GetCreateManySqlName

func (table *PostgresTable) GetCreateManySqlName() string

func (*PostgresTable) GetCreateSqlContent

func (table *PostgresTable) GetCreateSqlContent() string

func (*PostgresTable) GetCreateSqlName

func (table *PostgresTable) GetCreateSqlName() string

func (*PostgresTable) GetDeleteHardSqlContent

func (table *PostgresTable) GetDeleteHardSqlContent() string

func (*PostgresTable) GetDeleteHardSqlName

func (table *PostgresTable) GetDeleteHardSqlName() string

func (*PostgresTable) GetDeleteSoftSqlContent

func (table *PostgresTable) GetDeleteSoftSqlContent() string

func (*PostgresTable) GetDeleteSoftSqlName

func (table *PostgresTable) GetDeleteSoftSqlName() string

func (*PostgresTable) GetFieldFilters

func (table *PostgresTable) GetFieldFilters() []SelectFieldFilter

func (*PostgresTable) GetNow

func (table *PostgresTable) GetNow() string

func (*PostgresTable) GetPrimaryKeyConstructors

func (table *PostgresTable) GetPrimaryKeyConstructors() []PrimaryFieldInit

func (*PostgresTable) GetSelectPrimarySql

func (table *PostgresTable) GetSelectPrimarySql() []SelectQuery

func (*PostgresTable) GetSelectSql

func (table *PostgresTable) GetSelectSql() []SelectQueryRef

func (*PostgresTable) GetTableName

func (table *PostgresTable) GetTableName() string

func (*PostgresTable) GetUpdateManySqlContent

func (table *PostgresTable) GetUpdateManySqlContent() string

func (*PostgresTable) GetUpdateManySqlName

func (table *PostgresTable) GetUpdateManySqlName() string

func (*PostgresTable) GetUpdateSqlContent

func (table *PostgresTable) GetUpdateSqlContent() string

func (*PostgresTable) GetUpdateSqlName

func (table *PostgresTable) GetUpdateSqlName() string

func (*PostgresTable) GetUpsertManySqlContent

func (table *PostgresTable) GetUpsertManySqlContent() string

func (*PostgresTable) GetUpsertManySqlName

func (table *PostgresTable) GetUpsertManySqlName() string

func (*PostgresTable) GetUpsertSqlContent

func (table *PostgresTable) GetUpsertSqlContent() string

func (*PostgresTable) GetUpsertSqlName

func (table *PostgresTable) GetUpsertSqlName() string

func (*PostgresTable) HasInsertExtraCreated

func (table *PostgresTable) HasInsertExtraCreated() bool

func (*PostgresTable) HasInsertExtraUpdated

func (table *PostgresTable) HasInsertExtraUpdated() bool

func (*PostgresTable) HasStructCopy

func (table *PostgresTable) HasStructCopy() bool

func (*PostgresTable) HasUpdateExtraUpdated

func (table *PostgresTable) HasUpdateExtraUpdated() bool

type PrimaryFieldInit

type PrimaryFieldInit struct {
	Name   string
	Init   string
	Setter string
}

type SelectFieldFilter

type SelectFieldFilter struct {
	Model     string
	Table     string
	Name      string
	Field     string
	FieldType string
	Type      string
}

type SelectFilter

type SelectFilter struct {
	Model   string
	Name    string
	Pre     string
	Comment string
	Sql     string
	Args    []string
}

type SelectQuery

type SelectQuery struct {
	Name   string
	Fields []*PostgresColumn
	Method string
}

type SelectQueryRef

type SelectQueryRef struct {
	FromTable  string
	ToTable    string
	Fields     []*PostgresColumn
	GetMethod  string
	Ref        string
	FromAccess string
}

Jump to

Keyboard shortcuts

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