Documentation
¶
Index ¶
- Constants
- Variables
- func GetIntervalDurationFromTimeComponents(years, months, days, hours, minutes, seconds, nanos int64) duration.Duration
- func GetServerLocation(ctx *sql.Context) (*time.Location, error)
- func Init()
- func IterateCurrentDatabase(ctx *sql.Context, callbacks Callbacks) error
- func IterateDatabase(ctx *sql.Context, database string, callbacks Callbacks) error
- func RunCallback(ctx *sql.Context, internalID id.Id, callbacks Callbacks) error
- type Callbacks
- type ColumnWithIndex
- type ItemCheck
- type ItemColumnDefault
- type ItemForeignKey
- type ItemIndex
- type ItemSchema
- type ItemSequence
- type ItemTable
- type ItemView
Constants ¶
const ( NanosPerMicro = 1000 NanosPerMilli = NanosPerMicro * duration.MicrosPerMilli NanosPerSec = NanosPerMicro * duration.MicrosPerMilli * duration.MillisPerSec )
Variables ¶
var ErrStepSizeCannotEqualZero = errors.NewKind("step size cannot equal zero")
var ErrUnitNotSupported = errors.NewKind("unit \"%s\" not supported for type %s")
Functions ¶
func GetIntervalDurationFromTimeComponents ¶ added in v0.11.0
func GetServerLocation ¶ added in v0.16.0
GetServerLocation returns timezone value set for the server.
func IterateCurrentDatabase ¶ added in v0.16.0
IterateCurrentDatabase iterates over the current database, calling each callback as the relevant items are iterated over. This is a central function that homogenizes all iteration, since OIDs depend on a deterministic iteration over items. This function should be expanded as we add more items to iterate over.
func IterateDatabase ¶ added in v0.16.0
IterateDatabase iterates over the provided database, calling each callback as the relevant items are iterated over. This is a central function that homogenizes all iteration, since OIDs depend on a deterministic iteration over items. This function should be expanded as we add more items to iterate over.
func RunCallback ¶ added in v0.16.0
RunCallback iterates over schemas, etc. to find the item that the given oid points to. Once the item has been found, the relevant callback is called with the item. This means that, at most, only one callback will be called. If the item cannot be found, then no callbacks are called.
Types ¶
type Callbacks ¶ added in v0.16.0
type Callbacks struct { // Check is the callback for check constraints. Check func(ctx *sql.Context, schema ItemSchema, table ItemTable, check ItemCheck) (cont bool, err error) // ColumnDefault is the callback for column defaults. ColumnDefault func(ctx *sql.Context, schema ItemSchema, table ItemTable, check ItemColumnDefault) (cont bool, err error) // ForeignKey is the callback for foreign keys. ForeignKey func(ctx *sql.Context, schema ItemSchema, table ItemTable, foreignKey ItemForeignKey) (cont bool, err error) // Index is the callback for indexes. Index func(ctx *sql.Context, schema ItemSchema, table ItemTable, index ItemIndex) (cont bool, err error) // Schema is the callback for schemas/namespaces. Schema func(ctx *sql.Context, schema ItemSchema) (cont bool, err error) // Sequence is the callback for sequences. Sequence func(ctx *sql.Context, schema ItemSchema, sequence ItemSequence) (cont bool, err error) // Table is the callback for tables. Table func(ctx *sql.Context, schema ItemSchema, table ItemTable) (cont bool, err error) // View is the callback for views. View func(ctx *sql.Context, schema ItemSchema, view ItemView) (cont bool, err error) // SearchSchemas represents the search path. If left empty, then all schemas are iterated over. If supplied, then // schemas are iterated by their given order. SearchSchemas []string }
Callbacks are a set of callbacks that are used to simplify and coalesce all iteration involving database elements and their OIDs. All callbacks should be left nil except for the ones that are desired. Search paths are also supported through SearchSchemas.
type ColumnWithIndex ¶ added in v0.16.0
ColumnWithIndex is a helper struct to pass the column and its index to the ColumnDefault callback.
type ItemCheck ¶ added in v0.16.0
type ItemCheck struct { OID id.Check Item sql.CheckDefinition }
ItemCheck contains the relevant information to pass to the Check callback.
type ItemColumnDefault ¶ added in v0.16.0
type ItemColumnDefault struct { OID id.ColumnDefault Item ColumnWithIndex }
ItemColumnDefault contains the relevant information to pass to the ColumnDefault callback.
type ItemForeignKey ¶ added in v0.16.0
type ItemForeignKey struct { OID id.ForeignKey Item sql.ForeignKeyConstraint }
ItemForeignKey contains the relevant information to pass to the ForeignKey callback.
type ItemIndex ¶ added in v0.16.0
ItemIndex contains the relevant information to pass to the Index callback.
type ItemSchema ¶ added in v0.16.0
type ItemSchema struct { OID id.Namespace Item sql.DatabaseSchema }
ItemSchema contains the relevant information to pass to the Schema callback.
func (ItemSchema) IsSystemSchema ¶ added in v0.16.0
func (is ItemSchema) IsSystemSchema() bool
type ItemSequence ¶ added in v0.16.0
ItemSequence contains the relevant information to pass to the Sequence callback.
Source Files
¶
- abs.go
- acos.go
- acosd.go
- acosh.go
- advisory_locks.go
- age.go
- any.go
- anyarray.go
- anyelement.go
- anyenum.go
- anynonarray.go
- array.go
- array_append.go
- array_cat.go
- array_length.go
- array_position.go
- array_to_string.go
- array_upper.go
- ascii.go
- asin.go
- asind.go
- asinh.go
- atan.go
- atan2.go
- atan2d.go
- atand.go
- atanh.go
- bit_length.go
- bool.go
- bpchar.go
- btrim.go
- bytea.go
- cbrt.go
- ceil.go
- char.go
- char_length.go
- chr.go
- col_description.go
- cos.go
- cosd.go
- cosh.go
- cot.go
- cotd.go
- current_database.go
- current_schema.go
- current_schemas.go
- current_setting.go
- date.go
- date_part.go
- date_trunc.go
- degrees.go
- div.go
- dolt_procedures.go
- domain.go
- enum.go
- exp.go
- extract.go
- factorial.go
- float4.go
- float8.go
- floor.go
- format_type.go
- gcd.go
- gen_random_uuid.go
- generate_series.go
- generate_subscripts.go
- init.go
- initcap.go
- int2.go
- int4.go
- int8.go
- internal.go
- interval.go
- io_input.go
- iterate.go
- json.go
- jsonb.go
- lcm.go
- left.go
- length.go
- ln.go
- log.go
- log10.go
- lower.go
- lpad.go
- ltrim.go
- md5.go
- min_scale.go
- mod.go
- name.go
- nextval.go
- numeric.go
- obj_description.go
- octet_length.go
- oid.go
- pg_encoding_to_char.go
- pg_function_is_visible.go
- pg_get_constraintdef.go
- pg_get_expr.go
- pg_get_function_identity_arguments.go
- pg_get_functiondef.go
- pg_get_indexdef.go
- pg_get_partkeydef.go
- pg_get_serial_sequence.go
- pg_get_statisticsobjdef_columns.go
- pg_get_triggerdef.go
- pg_get_userbyid.go
- pg_get_viewdef.go
- pg_indexes_size.go
- pg_is_in_recovery.go
- pg_postmaster_start_time.go
- pg_relation_is_publishable.go
- pg_relation_size.go
- pg_stat_get_numscans.go
- pg_table_is_visible.go
- pg_table_size.go
- pg_tablespace_location.go
- pg_total_relation_size.go
- pg_type_is_visible.go
- pi.go
- power.go
- quote_ident.go
- radians.go
- random.go
- record.go
- regclass.go
- regproc.go
- regtype.go
- repeat.go
- replace.go
- reverse.go
- right.go
- round.go
- rpad.go
- rtrim.go
- scale.go
- set_config.go
- setval.go
- shell.go
- shobj_description.go
- sign.go
- sin.go
- sind.go
- sinh.go
- split_part.go
- sqrt.go
- strpos.go
- substr.go
- tan.go
- tand.go
- tanh.go
- text.go
- time.go
- timestamp.go
- timestamptz.go
- timetz.go
- timezone.go
- to_char.go
- to_hex.go
- to_regclass.go
- to_regproc.go
- to_regtype.go
- translate.go
- trim_scale.go
- trunc.go
- txid_current.go
- unknown.go
- unnest.go
- upper.go
- uuid.go
- varchar.go
- version.go
- void.go
- width_bucket.go
- xid.go