Documentation ¶
Index ¶
- type API
- type DB
- func (d *DB) Close() error
- func (d *DB) DistrictsGet(ctx context.Context, id uint64) ([]*pb.District, error)
- func (d *DB) Migrate(migrateDir string) error
- func (d *DB) NationalForestsGet(ctx context.Context, id uint64) ([]*pb.NationalForest, error)
- func (d *DB) SiteUpsert(ctx context.Context, latitude float32, longitude float32, ...) error
- func (d *DB) SitesGet(ctx context.Context, id uint64) ([]*pb.Site, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface { SitesGet(ctx context.Context, id uint64) ([]*pb.Site, error) SiteUpsert(ctx context.Context, latitude float32, longitude float32, nationalForestID uint64, districtID uint64, altitude uint64, notes string) error NationalForestsGet(ctx context.Context, id uint64) ([]*pb.NationalForest, error) DistrictsGet(ctx context.Context, id uint64) ([]*pb.District, error) }
API is the interface that the DB struct fulfills, with the methods to interact with DB. It exists to allow mocking of this package.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func New ¶
New returns an instantiated DB or an error if the database connection parameters don't work or it can not connect.
func (*DB) DistrictsGet ¶
DistrictsGet retrieves all districts
func (*DB) Migrate ¶
Migrate will perform any necessary migrations on the database. The location of the migration directory will need to be passed to this, since it will probably be manually copied to the server
func (*DB) NationalForestsGet ¶
NationalForestsGet retrieves all national forests
Click to show internal directories.
Click to hide internal directories.