example_test

package
v0.0.0-...-4c693ee Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SQLTxFromContext

func SQLTxFromContext(ctx context.Context) *sql.Tx

SQLTxFromContext returns an sql transaction from the context.

Types

type SQL

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

SQL represents an sql transaction.

func NewSQLTx

func NewSQLTx(ctx context.Context, db *sql.DB, weight uint) (*SQL, error)

NewSQLTx returns a new SQL transaction wrapped by a structure that satisfies the txgroup.Tx interface.

func (*SQL) Commit

func (s *SQL) Commit() error

Commit commits the transaction.

func (*SQL) Key

func (s *SQL) Key() string

Key returns the key used for storing SQL transactions in a context.

func (*SQL) Rollback

func (s *SQL) Rollback() error

Rollback discards the transaction.

func (*SQL) Weight

func (s *SQL) Weight() uint

Weight returns the priority number of the transaction.

type User

type User struct {
	ID string `json:"id,omitempty"`
}

User is the request body schema for this example.

Jump to

Keyboard shortcuts

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