mdm

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

README

mdm

Various Golang data models for my projects

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteBaseplate added in v0.1.4

func DeleteBaseplate(conn Connection, i int) error

DeleteBaseplate deletes a single baseplate from the database. It takes a connection object `conn` and an index `i` of the baseplate to delete. It returns an error if there was a problem deleting the baseplate from the database.

func NewBaseplate added in v0.1.4

func NewBaseplate(conn Connection, bp Baseplate) error

NewBaseplate creates a new baseplate and stores it in the database. It takes a connection object `conn` and a `bp` object of type `Baseplate`. It returns an error if there was a problem marshaling the `bp` object or storing it in the database.

func UpdateBaseplate added in v0.1.4

func UpdateBaseplate(conn Connection, i int, bp Baseplate) error

UpdateBaseplate updates a single baseplate in the database. It takes a connection object `conn`, an index `i` of the baseplate to update, and a `bp` object of type `Baseplate`. It returns an error if there was a problem marshaling the `bp` object or updating it in the database.

Types

type Baseplate

type Baseplate struct {
	Index       int
	Country     string
	State       string
	YearOfIssue string
	Name        string
}

func GetBaseplate added in v0.1.4

func GetBaseplate(conn Connection, i int) (Baseplate, error)

GetBaseplate retrieves a single baseplate from the database. It takes a connection object `conn` and an index `i` of the baseplate to retrieve. It returns a `Baseplate` object and an error if there was a problem unmarshaling the baseplate or retrieving it from the database.

func GetBaseplates added in v0.1.4

func GetBaseplates(conn Connection) ([]Baseplate, error)

GetBaseplates retrieves all baseplates from the database. It takes a connection object `conn` and returns a slice of `Baseplate` objects. It returns an error if there was a problem unmarshaling the baseplates or retrieving them from the database.

func GetBaseplatesByCountry added in v0.1.4

func GetBaseplatesByCountry(conn Connection, c string) ([]Baseplate, error)

GetBaseplatesByCountry retrieves all baseplates from the database that match the given country. It takes a connection object `conn` and a country `c` to match. It returns a slice of `Baseplate` objects and an error if there was a problem unmarshaling the baseplates or retrieving them from the database.

func GetBaseplatesByState added in v0.1.4

func GetBaseplatesByState(conn Connection, s string) ([]Baseplate, error)

GetBaseplatesByState retrieves all baseplates from the database that match the given state. It takes a connection object `conn` and a state `s` to match. It returns a slice of `Baseplate` objects and an error if there was a problem unmarshaling the baseplates or retrieving them from the database.

type Connection

type Connection struct {
	Client  *redis.Client
	Context context.Context
}

func NewConnection added in v0.1.3

func NewConnection(addr string) (Connection, error)

func (*Connection) Close added in v0.1.2

func (conn *Connection) Close() error

Jump to

Keyboard shortcuts

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