orderRoDataStore

package
v0.0.0-...-c79d29a Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type GetOrderByIdNewRow

type GetOrderByIdNewRow struct {
	OrderID  string `json:"order_id"`
	OrderQty int32  `json:"order_qty"`
}

type MySqlConfig

type MySqlConfig struct {
	Database             string `yaml:"database"`
	Host                 string `yaml:"host"`
	Port                 int    `yaml:"port"`
	User                 string `yaml:"user"`
	Password             string `yaml:"password"`
	MaxIdleConnection    int    `yaml:"max_idle_connections"`
	MaxOpenConnection    int    `yaml:"max_open_connections"`
	ConnMaxLifetimeInSec int    `yaml:"connection_max_lifetime_sec"`
	ConnMaxIdleTimeInSec int    `yaml:"connection_max_idle_time_sec"`
}

func (*MySqlConfig) GetConnMaxIdleTimeInSec

func (m *MySqlConfig) GetConnMaxIdleTimeInSec() int

GetConnMaxIdleTimeInSec returns the connection max idle time in seconds

func (*MySqlConfig) GetConnMaxLifetimeInSec

func (m *MySqlConfig) GetConnMaxLifetimeInSec() int

GetConnMaxLifetimeInSec returns the connection max lifetime in seconds

func (*MySqlConfig) GetDatabase

func (m *MySqlConfig) GetDatabase() string

GetDatabase returns the database name

func (*MySqlConfig) GetHost

func (m *MySqlConfig) GetHost() string

GetHost returns the database host

func (*MySqlConfig) GetMaxIdleConnection

func (m *MySqlConfig) GetMaxIdleConnection() int

GetMaxIdleConnection returns the maximum idle connections

func (*MySqlConfig) GetMaxOpenConnection

func (m *MySqlConfig) GetMaxOpenConnection() int

GetMaxOpenConnection returns the maximum open connections

func (*MySqlConfig) GetPassword

func (m *MySqlConfig) GetPassword() string

GetPassword returns the database password

func (*MySqlConfig) GetPort

func (m *MySqlConfig) GetPort() int

GetPort returns the database port

func (*MySqlConfig) GetUser

func (m *MySqlConfig) GetUser() string

GetUser returns the database user

func (*MySqlConfig) SetupDefault

func (m *MySqlConfig) SetupDefault()

type Order

type Order struct {
	OrderID   string       `json:"order_id"`
	OrderQty  int32        `json:"order_qty"`
	Amount    string       `json:"amount"`
	CreatedAt sql.NullTime `json:"created_at"`
	UpdatedAt sql.NullTime `json:"updated_at"`
}

type Querier

type Querier interface {
	//GetAllOrders
	//
	//  SELECT order_id, order_qty, amount, created_at, updated_at
	//  FROM orders
	//  ORDER BY created_at DESC
	GetAllOrders(ctx context.Context) ([]*Order, error)
	//GetOrderByID
	//
	//  SELECT order_id, order_qty, amount, created_at, updated_at
	//  FROM orders
	//  WHERE order_id = ?
	GetOrderByID(ctx context.Context, orderID string) (*Order, error)
	//GetOrderByIdNew
	//
	//  SELECT order_id, order_qty
	//  FROM orders
	//  WHERE order_id = ?
	GetOrderByIdNew(ctx context.Context, orderID string) (*GetOrderByIdNewRow, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func Prepare

func Prepare(ctx context.Context, db DBTX) (*Queries, error)

func (*Queries) Close

func (q *Queries) Close() error

func (*Queries) GetAllOrders

func (q *Queries) GetAllOrders(ctx context.Context) ([]*Order, error)

GetAllOrders

SELECT order_id, order_qty, amount, created_at, updated_at
FROM orders
ORDER BY created_at DESC

func (*Queries) GetOrderByID

func (q *Queries) GetOrderByID(ctx context.Context, orderID string) (*Order, error)

GetOrderByID

SELECT order_id, order_qty, amount, created_at, updated_at
FROM orders
WHERE order_id = ?

func (*Queries) GetOrderByIdNew

func (q *Queries) GetOrderByIdNew(ctx context.Context, orderID string) (*GetOrderByIdNewRow, error)

GetOrderByIdNew

SELECT order_id, order_qty
FROM orders
WHERE order_id = ?

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

Jump to

Keyboard shortcuts

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