db2

package
v0.0.0-...-3037a55 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: EUPL-1.2 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTable

func AddTable(t any, tbl string)

func Insert

func Insert(ctx context.Context, t any, extraSQL ...string) error

Insert all struct fields of t in the table tbl.

Column names are taken from the db tag. Fields with the db tag set to "-" or that have the ",noinsert" option will be skipped.

If a field has the ",id" option it will be set.

func Update

func Update(ctx context.Context, old, new any) (map[string][2]any, error)

Update all fields that are changed between old and new.

No SQL is run if old and new are identical.

Returns a map of changes, as [2]any{oldValue, newValue}.

Types

This section is empty.

Jump to

Keyboard shortcuts

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