db

package
v0.0.0-...-4982e5b Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PGDevice

type PGDevice struct {
	DBPool *pgxpool.Pool
}

PGDevice holds the DB connection pool.

func (*PGDevice) Delete

func (pg *PGDevice) Delete(id int) error

Delete removes a device by it's PK.

func (*PGDevice) GetAll

func (pg *PGDevice) GetAll() ([]models.Device, error)

GetAll returns all devices in the table.

func (*PGDevice) GetByHostname

func (pg *PGDevice) GetByHostname(name string) (models.Device, error)

GetByHostname returns a specific device matching the provided hostname.

func (*PGDevice) GetByID

func (pg *PGDevice) GetByID(id int) (models.Device, error)

GetByID returns a specific device matching the provided PK.

func (*PGDevice) New

func (pg *PGDevice) New(device models.Device) error

New adds a device to the table.

func (*PGDevice) Update

func (pg *PGDevice) Update(device models.Device) error

Update modifies an existing device.

type PGModel

type PGModel struct {
	DBPool *pgxpool.Pool
}

PGModel holds the DB connection pool.

func (*PGModel) Delete

func (pg *PGModel) Delete(id int) error

Delete removes a model by it's PK.

func (*PGModel) GetAll

func (pg *PGModel) GetAll() ([]models.Model, error)

GetAll returns all models in the table.

func (*PGModel) GetByID

func (pg *PGModel) GetByID(id int) (models.Model, error)

GetByID returns a specific model matching the provided PK.

func (*PGModel) GetByName

func (pg *PGModel) GetByName(name string) (models.Model, error)

GetByName returns a specific model matching the provided name.

func (*PGModel) New

func (pg *PGModel) New(model models.Model) error

New adds a model to the table.

func (*PGModel) Update

func (pg *PGModel) Update(model models.Model) error

Update modifies an existing model.

type PGVendor

type PGVendor struct {
	DBPool *pgxpool.Pool
}

PGVendor holds the DB connection pool.

func (*PGVendor) Delete

func (pg *PGVendor) Delete(id int) error

Delete removes a vendor by it's PK.

func (*PGVendor) GetAll

func (pg *PGVendor) GetAll() ([]models.Vendor, error)

GetAll returns all vendors in the table.

func (*PGVendor) GetByID

func (pg *PGVendor) GetByID(id int) (models.Vendor, error)

GetByID returns a specific vendor matching the provided PK.

func (*PGVendor) GetByName

func (pg *PGVendor) GetByName(name string) (models.Vendor, error)

GetByName returns a specific vendor matching the provided name.

func (*PGVendor) New

func (pg *PGVendor) New(name string) error

New adds a vendor to the table.

func (*PGVendor) Update

func (pg *PGVendor) Update(vendor models.Vendor) error

Update modifies an existing vendor.

Jump to

Keyboard shortcuts

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