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

option

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 14 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMatch = errors.New("if-match write did not affect exactly one row")

ErrNoMatch means an IfMatch update or delete did not affect exactly one row.

Functions

func Assign

func Assign(options []Option, supplied ...interface{}) bool

Assign assigns supplied option, if returns un assign options and true if assign at least one

Types

type Args

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

Args represents prepare statement arguments

func NewArgs

func NewArgs(args ...interface{}) *Args

NewArgs creates option arguments

func (*Args) Size added in v0.3.0

func (a *Args) Size() int

Size returns arguments size

func (*Args) StringN

func (a *Args) StringN(n int) ([]string, error)

StringN returns first n option arguments as strings

func (*Args) Unwrap

func (a *Args) Unwrap() []interface{}

Unwrap returns options arguments as interfaces

type BatchSize

type BatchSize int

BatchSize represents a batch size options

type ColumnRestriction

type ColumnRestriction map[string]bool

func (ColumnRestriction) CanUse

func (r ColumnRestriction) CanUse(column string) bool

type Columns

type Columns []string

Columns option to control which column to operate on

func (Columns) Restriction

func (u Columns) Restriction() ColumnRestriction

type Identity

type Identity string

Identity represents identity option

type IdentityOnly

type IdentityOnly bool

IdentityOnly represents identity (pk) only option

type IfMatch added in v0.26.1

type IfMatch struct {
	Column string
	Value  any
}

IfMatch adds an expected column value to an update or delete predicate. It is an execution option: the expected value belongs to one write, not to the reusable service. A missing or ambiguous row returns ErrNoMatch.

type InsertIgnore added in v0.26.1

type InsertIgnore bool

InsertIgnore selects MySQL's fixed INSERT IGNORE mode when constructing an insert service or builder. It does not change identity allocation policy.

type LoadFormat

type LoadFormat string

LoadFormat represents the format of data loaded

type LoadHint

type LoadHint string

LoadHint represents the bigquery.JobConfigurationLoad in json format

type MetaSessionCache added in v0.21.0

type MetaSessionCache struct {
	Map *sync.Map
}

MetaSessionCache wraps a sync.Map used for caching metadata sessions

type MetaSessionCacheKey added in v0.21.0

type MetaSessionCacheKey string

type OnDuplicateKeySql added in v0.15.2

type OnDuplicateKeySql string

OnDuplicateKeySql represents SQL suffix

type Option

type Option interface{}

Option represents generic option

func WithMetaSessionCache added in v0.21.0

func WithMetaSessionCache(cache *sync.Map) Option

WithMetaSessionCache creates an option carrying a metadata session cache

type Options

type Options []Option

Options represents generic options

func AsOptions

func AsOptions(options []interface{}) Options

AsOptions case slice of interface to Options

func (Options) Args

func (o Options) Args() *Args

Args returns *Args option

func (Options) BatchSize

func (o Options) BatchSize() int

BatchSize returns batch size option

func (Options) Columns

func (o Options) Columns() Columns

Columns returns map of updateable columns

func (Options) Criteria added in v0.26.1

func (o Options) Criteria() *sqlx.Criteria

Criteria combines native predicate options with ordered bound arguments. It does not evaluate predicates or decide whether an input was provided.

func (Options) Db added in v0.7.0

func (o Options) Db() *sql.DB

Db returns *sql.Db or nil

func (Options) Dialect

func (o Options) Dialect() *info.Dialect

Dialect returns dialect

func (Options) Identity

func (o Options) Identity() string

Identity returns identity column

func (Options) IdentityOnly

func (o Options) IdentityOnly() bool

IdentityOnly returns identity only option value or false

func (Options) IfMatch added in v0.26.1

func (o Options) IfMatch() *IfMatch

IfMatch returns the optional atomic match condition for this execution.

func (Options) InsertIgnore added in v0.26.1

func (o Options) InsertIgnore() bool

InsertIgnore returns the fixed insert mode, which defaults to ordinary INSERT.

func (Options) Interfaces

func (o Options) Interfaces() []interface{}

Interfaces returns current options as interfaces

func (Options) LoadFormat

func (o Options) LoadFormat() string

LoadFormat returns LoadFormat

func (Options) LoadHint

func (o Options) LoadHint() string

LoadHint return LoadHint

func (Options) MaxIDSQLBuilder

func (o Options) MaxIDSQLBuilder() func() *sqlx.SQL

MaxIDSQLBuilder returns function returning SQL which gets max identity value from table

func (Options) MetaSessionCache added in v0.21.0

func (o Options) MetaSessionCache() *sync.Map

MetaSessionCache returns the provided metadata session cache or nil

func (Options) OnDuplicateKeySql added in v0.15.2

func (o Options) OnDuplicateKeySql() string

OnDuplicateKeySql returns OnDuplicateKeySql option

func (Options) PresetIDStrategy

func (o Options) PresetIDStrategy() dialect.PresetIDStrategy

PresetIDStrategy returns PresetIDStrategy option

func (Options) Product

func (o Options) Product() *database.Product

Product returns product

func (Options) RecordCount

func (o Options) RecordCount() int64

RecordCount returns record count option

func (Options) SQL

func (o Options) SQL() *sqlx.SQL

SQL returns sqlx.SQL

func (Options) SequenceColumn added in v0.26.1

func (o Options) SequenceColumn() string

func (Options) SequenceField added in v0.26.1

func (o Options) SequenceField() string

func (Options) SequenceIdentityOnly added in v0.26.0

func (o Options) SequenceIdentityOnly() bool

func (Options) SequenceReservationIntent added in v0.26.1

func (o Options) SequenceReservationIntent() bool

func (Options) SequenceSQLBuilder

func (o Options) SequenceSQLBuilder() func(*sink.Sequence) (*sqlx.SQL, int64, error)

SequenceSQLBuilder returns sqlx.SQL

func (Options) SequenceTable added in v0.26.0

func (o Options) SequenceTable() string

SequenceTable returns the physical allocation table, if supplied.

func (Options) SetMarker added in v0.7.0

func (o Options) SetMarker() *SetMarker

SetMarker returns SetMarker option value or false

func (Options) StructOrderedColumns added in v0.14.0

func (o Options) StructOrderedColumns() bool

StructOrderedColumns returns identity only option value or false

func (Options) Tx

func (o Options) Tx() *sql.Tx

Tx returns *sql.Tx or nil

type RecordCount

type RecordCount int64

RecordCount represents record count option

type SequenceColumn added in v0.26.1

type SequenceColumn string

SequenceColumn is the numeric column selected by the native insert mapper.

type SequenceField added in v0.26.1

type SequenceField string

SequenceField selects a Go field through the native insert mapper, without asking an application to parse sqlx tags or infer a physical column name.

type SequenceIdentityOnly added in v0.26.0

type SequenceIdentityOnly bool

SequenceIdentityOnly requests read-only identity/arithmetic metadata rather than a current counter. It never authorizes a sequence reservation.

type SequenceReservationIntent added in v0.26.1

type SequenceReservationIntent bool

SequenceReservationIntent requests the product's allocation preparation before reading identity metadata, without selecting or overriding its preset strategy.

type SequenceTable added in v0.26.0

type SequenceTable string

SequenceTable identifies the physical table whose numeric IDs are allocated. It is distinct from an authored sequence name, which need not name a table.

type SetMarker added in v0.7.0

type SetMarker struct {
	*structology.Marker
	IdentityIndex int
}

func (*SetMarker) Placeholders added in v0.7.0

func (p *SetMarker) Placeholders(record interface{}, placeholders []interface{}) []interface{}

type StructOrderedColumns added in v0.14.0

type StructOrderedColumns bool

StructOrderedColumns is an option that represents the same column order as the struct field order

type Tag

type Tag string

Tag represent a annotation tag name

Jump to

Keyboard shortcuts

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