pgdialect

package module
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: BSD-2-Clause Imports: 26 Imported by: 600

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Version added in v1.0.22

func Version() string

Version is the current release version.

Types

type ArrayValue

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

func Array

func Array(vi interface{}) *ArrayValue

Array accepts a slice and returns a wrapper for working with PostgreSQL array data type.

For struct fields you can use array tag:

Emails  []string `bun:",array"`

func (*ArrayValue) AppendQuery

func (a *ArrayValue) AppendQuery(fmter schema.Formatter, b []byte) ([]byte, error)

func (*ArrayValue) Scan

func (a *ArrayValue) Scan(src interface{}) error

func (*ArrayValue) Value

func (a *ArrayValue) Value() interface{}

type Column added in v1.2.6

type Column = sqlschema.BaseColumn

type Dialect

type Dialect struct {
	schema.BaseDialect
	// contains filtered or unexported fields
}

func New

func New() *Dialect

func (*Dialect) AppendSequence added in v1.1.17

func (d *Dialect) AppendSequence(b []byte, _ *schema.Table, _ *schema.Field) []byte

func (*Dialect) AppendUint32 added in v1.0.14

func (d *Dialect) AppendUint32(b []byte, n uint32) []byte

func (*Dialect) AppendUint64 added in v1.0.14

func (d *Dialect) AppendUint64(b []byte, n uint64) []byte

func (*Dialect) CompareType added in v1.2.6

func (d *Dialect) CompareType(col1, col2 sqlschema.Column) bool

func (*Dialect) DefaultSchema added in v1.2.6

func (d *Dialect) DefaultSchema() string

func (*Dialect) DefaultVarcharLen added in v1.1.10

func (d *Dialect) DefaultVarcharLen() int

func (*Dialect) Features

func (d *Dialect) Features() feature.Feature

func (*Dialect) IdentQuote

func (d *Dialect) IdentQuote() byte

func (*Dialect) Init added in v0.2.14

func (d *Dialect) Init(*sql.DB)

func (*Dialect) Name

func (d *Dialect) Name() dialect.Name

func (*Dialect) NewInspector added in v1.2.6

func (d *Dialect) NewInspector(db *bun.DB, options ...sqlschema.InspectorOption) sqlschema.Inspector

func (*Dialect) NewMigrator added in v1.2.6

func (d *Dialect) NewMigrator(db *bun.DB, schemaName string) sqlschema.Migrator

func (*Dialect) OnTable

func (d *Dialect) OnTable(table *schema.Table)

func (*Dialect) Tables

func (d *Dialect) Tables() *schema.Tables

type ForeignKey added in v1.2.6

type ForeignKey struct {
	ConstraintName string   `bun:"constraint_name"`
	SourceSchema   string   `bun:"schema_name"`
	SourceTable    string   `bun:"table_name"`
	SourceColumns  []string `bun:"columns,array"`
	TargetSchema   string   `bun:"target_schema"`
	TargetTable    string   `bun:"target_table"`
	TargetColumns  []string `bun:"target_columns,array"`
}

type HStoreValue added in v1.1.6

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

func HStore added in v1.1.6

func HStore(vi interface{}) *HStoreValue

HStore accepts a map[string]string and returns a wrapper for working with PostgreSQL hstore data type.

For struct fields you can use hstore tag:

Attrs  map[string]string `bun:",hstore"`

func (*HStoreValue) AppendQuery added in v1.1.6

func (h *HStoreValue) AppendQuery(fmter schema.Formatter, b []byte) ([]byte, error)

func (*HStoreValue) Scan added in v1.1.6

func (h *HStoreValue) Scan(src interface{}) error

func (*HStoreValue) Value added in v1.1.6

func (h *HStoreValue) Value() interface{}

type InformationSchemaColumn added in v1.2.6

type InformationSchemaColumn struct {
	Schema           string   `bun:"table_schema"`
	Table            string   `bun:"table_name"`
	Name             string   `bun:"column_name"`
	DataType         string   `bun:"data_type"`
	VarcharLen       int      `bun:"varchar_len"`
	IsArray          bool     `bun:"is_array"`
	ArrayDims        int      `bun:"array_dims"`
	Default          string   `bun:"default"`
	IsDefaultLiteral bool     `bun:"default_is_literal_expr"`
	IsIdentity       bool     `bun:"is_identity"`
	IndentityType    string   `bun:"identity_type"`
	IsSerial         bool     `bun:"is_serial"`
	IsNullable       bool     `bun:"is_nullable"`
	UniqueGroups     []string `bun:"unique_groups,array"`
}

type InformationSchemaTable added in v1.2.6

type InformationSchemaTable struct {
	Schema     string     `bun:"table_schema,pk"`
	Name       string     `bun:"table_name,pk"`
	PrimaryKey PrimaryKey `bun:"embed:primary_key_"`

	Columns []*InformationSchemaColumn `bun:"rel:has-many,join:table_schema=table_schema,join:table_name=table_name"`
}

type Inspector added in v1.2.6

type Inspector struct {
	sqlschema.InspectorConfig
	// contains filtered or unexported fields
}

func (*Inspector) Inspect added in v1.2.6

func (in *Inspector) Inspect(ctx context.Context) (sqlschema.Database, error)

type MultiRange added in v1.2.2

type MultiRange[T any] []Range[T]

type PrimaryKey added in v1.2.6

type PrimaryKey struct {
	ConstraintName string   `bun:"name"`
	Columns        []string `bun:"columns,array"`
}

type Range added in v1.2.2

type Range[T any] struct {
	Lower, Upper           T
	LowerBound, UpperBound RangeBound
}

func NewRange added in v1.2.2

func NewRange[T any](lower, upper T) Range[T]

func (*Range[T]) AppendQuery added in v1.2.2

func (r *Range[T]) AppendQuery(fmt schema.Formatter, buf []byte) ([]byte, error)

func (*Range[T]) Scan added in v1.2.2

func (r *Range[T]) Scan(anySrc any) (err error)

type RangeBound added in v1.2.2

type RangeBound byte
const (
	RangeBoundInclusiveLeft  RangeBound = '['
	RangeBoundInclusiveRight RangeBound = ']'
	RangeBoundExclusiveLeft  RangeBound = '('
	RangeBoundExclusiveRight RangeBound = ')'
)

type Schema added in v1.2.6

type Schema = sqlschema.BaseDatabase

type Table added in v1.2.6

type Table = sqlschema.BaseTable

Jump to

Keyboard shortcuts

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