generator

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) GetCreateManySQLArg added in v0.0.6

func (table *PostgresTable) GetCreateManySQLArg() []string

func (*PostgresTable) GetCreateManySQLContent

func (table *PostgresTable) GetCreateManySQLContent() string

func (*PostgresTable) GetCreateSQLContent

func (table *PostgresTable) GetCreateSQLContent() string

func (*PostgresTable) GetDeleteHardSQLContent

func (table *PostgresTable) GetDeleteHardSQLContent() 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) GetInsertSQLColumnsSorted

func (table *PostgresTable) GetInsertSQLColumnsSorted() []*PostgresColumn

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) GetUpdateManySQLContent

func (table *PostgresTable) GetUpdateManySQLContent() string

func (*PostgresTable) GetUpdateSQLColumnsSorted

func (table *PostgresTable) GetUpdateSQLColumnsSorted() []*PostgresColumn

func (*PostgresTable) GetUpdateSQLContent

func (table *PostgresTable) GetUpdateSQLContent() string

func (*PostgresTable) GetUpsertManySQLContent

func (table *PostgresTable) GetUpsertManySQLContent() string

func (*PostgresTable) GetUpsertSQLContent

func (table *PostgresTable) GetUpsertSQLContent() string

func (*PostgresTable) HasInsertExtraCreated

func (table *PostgresTable) HasInsertExtraCreated() bool

func (*PostgresTable) HasInsertExtraUpdated

func (table *PostgresTable) HasInsertExtraUpdated() bool

func (*PostgresTable) HasInsertReturning

func (table *PostgresTable) HasInsertReturning() bool

func (*PostgresTable) HasStructCopy

func (table *PostgresTable) HasStructCopy() bool

func (*PostgresTable) HasUpdateExtraUpdated

func (table *PostgresTable) HasUpdateExtraUpdated() bool

func (*PostgresTable) HasUpdateReturning

func (table *PostgresTable) HasUpdateReturning() bool

func (*PostgresTable) IsInsertMany added in v0.0.6

func (table *PostgresTable) IsInsertMany() 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
	PreSQL  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