Documentation ¶
Overview ¶
Package yowrap provides a wrapper around the generated Yo model.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoClient = errors.New("no spanner client")
ErrNoClient is returned when the spanner client is not set.
Functions ¶
This section is empty.
Types ¶
type Hook ¶
type Hook int
Hook defines an action that can be executed during a mutation.
const ( // AfterInsert is executed when the Insert txn is called. AfterInsert Hook = iota + 1 // AfterUpdate is executed when the Update txn is called. AfterUpdate // AfterInsertOrUpdate is executed when the InsertOrUpdate txn is called. AfterInsertOrUpdate // AfterDelete is executed when the Delete txn is called. AfterDelete // BeforeInsert is executed before the Insert txn is called. BeforeInsert // BeforeUpdate is executed before the Update txn is called. BeforeUpdate // BeforeInsertOrUpdate is executed before the InsertOrUpdate txn is called. BeforeInsertOrUpdate // BeforeDelete is executed before the Delete txn is called. BeforeDelete )
type HookFunc ¶
HookFunc defines a function that could be executed during a transaction. The function should return an error if the transaction should be aborted. This funcions are used for create hooks that are executed before or after. This hooks are able to modify the model before the transaction is executed or create some new stuff during the ongoin transaction.
type Model ¶
type Model[T Yoable[T]] struct { Yoable[T] spanner.Client // contains filtered or unexported fields }
Model is a struct that embeds the generated model and implements the Yo interface.
type Mutation ¶
type Mutation int
Mutation defines a mutation that can be executed within spanner.
const ( // Insert is a mutation that inserts a row into a table. Insert Mutation = iota + 1 // Update is a mutation that updates a row in a table. Update // InsertOrUpdate is a mutation that inserts a row into a table. If the row // already exists, it updates it instead. Any column values not explicitly // written are preserved. InsertOrUpdate // Delete is a mutation that deletes a row from a table. Delete )