data

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	QueryTrucks(query string) ([]TruckRow, error)
}

The Database spec defines the interface for a database

type SQLiteDB

type SQLiteDB struct {
	*sql.DB
}

A concrete implementation of data.Database that uses SQLite

func NewDatabase

func NewDatabase(dbFilePath string) *SQLiteDB

func (*SQLiteDB) QueryTrucks added in v0.0.8

func (db *SQLiteDB) QueryTrucks(q string) ([]TruckRow, error)

QueryTrucks returns a list of trucks from the database TODO: This is a leaky abstraction, we could do A LOT better here! Needs to be refactored

type TruckRow added in v0.0.8

type TruckRow struct {
	ID          sql.NullString
	Name        sql.NullString
	Description sql.NullString
	Lat         sql.NullFloat64
	Long        sql.NullFloat64
	Address     sql.NullString
}

"TruckRow" is data returned from the database

Jump to

Keyboard shortcuts

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