sql

package
v2.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 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 DB

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

DB represents a SQL database

func New

func New(driver, dsn string) (*DB, error)

New returns a new DB with the given driver and DSN or an error if one occurred

func (*DB) Begin

func (d *DB) Begin() (*sql.Tx, error)

Begin returns a transaction for the database or an error if one occurred

func (*DB) CreateCharge

func (d *DB) CreateCharge(tx *sql.Tx, charges db.Charges, inventoryNumber, user, notes string) (id int64, err error)

CreateCharge creates a charge in the database with the given info and returns the ID of the charges or an error if one occurred

func (*DB) ReadDevice

func (d *DB) ReadDevice(tx *sql.Tx, bagTag string) (*db.Device, error)

ReadDevice returns the Device with with the given bagTag or an error if one occurred

func (*DB) UpdateDevice

func (d *DB) UpdateDevice(tx *sql.Tx, device *db.Device, username string) error

UpdateDevice updates the given Device by the given username or returns an error if one occurred

Jump to

Keyboard shortcuts

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