storage

package
v0.0.0-...-a116991 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CREATE_TRANSACTION = "INSERT INTO transacoes(cliente_id, valor, descricao) values ($1, $2, $3)"
	UPDATE_SALDO       = "UPDATE clientes set saldo = saldo + $2 where id = $1"
	GET_SALDO          = "SELECT limite, saldo from clientes where id = $1"
	GET_EXTRATO        = "SELECT cliente_id, valor, descricao, data from transacoes where cliente_id = $1 order by data desc limit 10"
	GET_LOCK           = "SELECT pg_advisory_xact_lock($1)"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host         string
	User         string
	Password     string
	DatabaseName string

	MinConns int32
	MaxConns int32
}

type Storage

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

func New

func New(config *Config) (*Storage, error)

func (Storage) Close

func (s Storage) Close()

func (Storage) CreateTransacao

func (s Storage) CreateTransacao(ctx context.Context, t rinha.Transacao) (rinha.Saldo, error)

func (Storage) GetExtrato

func (s Storage) GetExtrato(ctx context.Context, clienteId int) (rinha.Extrato, error)

Jump to

Keyboard shortcuts

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