sqlite

package
v0.0.0-...-a230d7d Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDSNRequired = errors.New("DSN required")
)

Functions

This section is empty.

Types

type DB

type DB struct {
	DB *sql.DB

	// Data source name.
	DSN string

	// Returns the current time. Defaults to time.Now().
	// Can be mocked for tests.
	Now func() time.Time
	// contains filtered or unexported fields
}

DB represents the database connection. Based off Ben Johnson's WTF Dial example. https://github.com/benbjohnson/wtf

func NewDB

func NewDB(dsn string) *DB

func (*DB) Close

func (db *DB) Close() error

func (*DB) Open

func (db *DB) Open() (err error)

Open opens the database connection.

type SiteService

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

func NewSiteService

func NewSiteService(db sqlc.DBTX) *SiteService

func (*SiteService) AddSite

func (s *SiteService) AddSite(ctx context.Context, site pc.Site) error

func (*SiteService) DeletePolicy

func (s *SiteService) DeletePolicy(ctx context.Context, siteID uint32, species string) (pc.Policy, error)

func (*SiteService) GetPolicy

func (s *SiteService) GetPolicy(ctx context.Context, siteID uint32, species string) (pc.Policy, error)

func (*SiteService) GetSite

func (s *SiteService) GetSite(ctx context.Context, siteID uint32) (pc.Site, error)

func (*SiteService) SetPolicy

func (s *SiteService) SetPolicy(ctx context.Context, siteID uint32, species string, action pc.PolicyAction) error

func (*SiteService) SetTargetPopulations

func (s *SiteService) SetTargetPopulations(ctx context.Context, siteID uint32, pops []pc.TargetPopulation) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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