sequence

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateMySQLSequence

func UpdateMySQLSequence(ctx context.Context, db *sql.DB, target interface{}, iopts ...interface{}) (doNext bool, err error)

UpdateMySQLSequence updates for all passed sink.Sequences theirs Value or StartValue getting autoincrement metadata by: SHOW CREATE TABLE ..., @@SESSION.auto_increment_increment, @@SESSION.auto_increment_offset

Warning! Until we don't use autoincrement in the table (by insert at least one row with 0-value id), "show create table" and "information_schema.tables" show wrong autoincrement value if @@SESSION.auto_increment_increment > 1

Types

type Transient

type Transient struct{}

Transient represents struct used to setting new autoincrement value using insert inside new transaction finished by rollback

func (*Transient) CanUse

func (n *Transient) CanUse(iopts ...interface{}) bool

CanUse returns true if Handle function can be executed

func (*Transient) Handle

func (n *Transient) Handle(ctx context.Context, db *sql.DB, target interface{}, iopts ...interface{}) (doNext bool, err error)

Handle sets new autoincrement value by inserting row using new transaction finished by rollback, uses locking

type Udf

type Udf struct{}

Udf represents struct used to setting new autoincrement value using user defined stored procedure in db and internal autoincrement value handling

func (*Udf) CanUse

func (n *Udf) CanUse(iopts ...interface{}) bool

CanUse returns true if Handle function can be executed

func (*Udf) Handle

func (n *Udf) Handle(ctx context.Context, db *sql.DB, target interface{}, iopts ...interface{}) (doNext bool, err error)

Handle sets new autoincrement value by executing user defined stored procedure and using internal autoincrement value handling

all this handler requires more testing (especially with transactions)

Jump to

Keyboard shortcuts

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