mongo

package
v0.0.0-...-d1a2b61 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accessor

type Accessor interface {
	Client() *Client
	Collection() *mongo.Collection
}

type CaseDAL

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

CaseDAL represents a service for managing suppliers.

func (*CaseDAL) Client

func (s *CaseDAL) Client() *Client

func (*CaseDAL) Collection

func (s *CaseDAL) Collection() *mongo.Collection

func (*CaseDAL) Get

func (s *CaseDAL) Get(dep string, date time.Time) (*covidtracker.Case, error)

func (*CaseDAL) GetRange

func (s *CaseDAL) GetRange(dep string, start, end time.Time) ([]*covidtracker.Case, error)

func (*CaseDAL) Upsert

func (s *CaseDAL) Upsert(cases ...*covidtracker.Case) error

type Client

type Client struct {
	MongoURI string
	// Returns the current time.
	Now func() time.Time
	Ctx context.Context
	// contains filtered or unexported fields
}

Client encapsulates the mongo client

func NewClient

func NewClient(mongoURI string) *Client

NewClient creates a new client with mongodb scheme : mongodb://xxxx

func (*Client) Case

func (c *Client) Case() covidtracker.CaseDAL

Case returns the dal for hospital service with at least one declared case

func (*Client) Close

func (c *Client) Close() error

Close disconnect the underlying mongo database.

func (*Client) Emergency

func (c *Client) Emergency() covidtracker.EmergencyDAL

Emergency returns the dal for emergency data

func (*Client) Hospitalization

func (c *Client) Hospitalization() covidtracker.HospDAL

Hospitalization returns the dal for hospitalization data

func (*Client) Hotel

func (c *Client) Hotel() covidtracker.HotelDAL

Hotel returns the dal for hotel

func (*Client) Indicator

func (c *Client) Indicator() covidtracker.IndicDAL

Indicator returns the dal for indicator data

func (*Client) Open

func (c *Client) Open() error

Open opens and initializes the Mongo database.

func (*Client) Risk

func (c *Client) Risk() covidtracker.RiskDAL

Risk returns the dal for risk

func (*Client) RiskParameters

func (c *Client) RiskParameters() covidtracker.RiskParametersDAL

Parameters returns the dal for parameters

func (*Client) Screening

func (c *Client) Screening() covidtracker.ScreeningDAL

Screening returns the dal for screening data

type EmergencyDAL

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

EmergencyDAL represents a service for managing suppliers.

func (*EmergencyDAL) Client

func (s *EmergencyDAL) Client() *Client

func (*EmergencyDAL) Collection

func (s *EmergencyDAL) Collection() *mongo.Collection

func (*EmergencyDAL) Get

func (s *EmergencyDAL) Get(dep string, date time.Time) (*covidtracker.Emergency, error)

func (*EmergencyDAL) GetRange

func (s *EmergencyDAL) GetRange(dep string, start, end time.Time) ([]*covidtracker.Emergency, error)

func (*EmergencyDAL) Upsert

func (s *EmergencyDAL) Upsert(ems ...*covidtracker.Emergency) error

type HospDAL

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

HospDAL represents a service for managing suppliers.

func (*HospDAL) Client

func (s *HospDAL) Client() *Client

func (*HospDAL) Collection

func (s *HospDAL) Collection() *mongo.Collection

func (*HospDAL) Get

func (s *HospDAL) Get(dep string, date time.Time) (*covidtracker.Hospitalization, error)

func (*HospDAL) GetRange

func (s *HospDAL) GetRange(dep string, start, end time.Time) ([]*covidtracker.Hospitalization, error)

func (*HospDAL) Upsert

func (s *HospDAL) Upsert(hosps ...*covidtracker.Hospitalization) error

type HotelDAL

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

func (*HotelDAL) Client

func (s *HotelDAL) Client() *Client

func (*HotelDAL) Collection

func (s *HotelDAL) Collection() *mongo.Collection

func (*HotelDAL) Get

Get returns a hotel by ID.

func (*HotelDAL) Insert

func (s *HotelDAL) Insert(hotels []*covidtracker.Hotel) ([]*covidtracker.Hotel, error)

Insert CdsApi result

type IndicDAL

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

IndicDAL represents a service for managing suppliers.

func (*IndicDAL) Client

func (s *IndicDAL) Client() *Client

func (*IndicDAL) Collection

func (s *IndicDAL) Collection() *mongo.Collection

func (*IndicDAL) Get

func (s *IndicDAL) Get(dep string, date time.Time) (*covidtracker.Indicator, error)

func (*IndicDAL) GetRange

func (s *IndicDAL) GetRange(dep int, start, end time.Time) ([]*covidtracker.Indicator, error)

func (*IndicDAL) Upsert

func (s *IndicDAL) Upsert(inds ...*covidtracker.Indicator) error

type RiskDAL

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

RiskService represents a service for managing suppliers.

func (*RiskDAL) Client

func (s *RiskDAL) Client() *Client

func (*RiskDAL) Collection

func (s *RiskDAL) Collection() *mongo.Collection

func (*RiskDAL) Get

Get returns a risk by ID.

func (*RiskDAL) Insert

func (s *RiskDAL) Insert(risks ...*covidtracker.Risk) error

Create creates new risks.

type RiskParametersDAL

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

func (*RiskParametersDAL) Client

func (s *RiskParametersDAL) Client() *Client

func (*RiskParametersDAL) Collection

func (s *RiskParametersDAL) Collection() *mongo.Collection

func (*RiskParametersDAL) GetDefault

func (s *RiskParametersDAL) GetDefault() (*covidtracker.RiskParameters, error)

GetDefault returns the default parameters from db

func (*RiskParametersDAL) Insert

Insert creates new parameters.

type ScreeningDAL

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

ScreeningDAL represents a service for managing suppliers.

func (*ScreeningDAL) Client

func (s *ScreeningDAL) Client() *Client

func (*ScreeningDAL) Collection

func (s *ScreeningDAL) Collection() *mongo.Collection

func (*ScreeningDAL) Get

func (s *ScreeningDAL) Get(dep string, date time.Time) (*covidtracker.Screening, error)

func (*ScreeningDAL) GetRange

func (s *ScreeningDAL) GetRange(dep string, start, end time.Time) ([]*covidtracker.Screening, error)

func (*ScreeningDAL) Upsert

func (s *ScreeningDAL) Upsert(scrs ...*covidtracker.Screening) error

Jump to

Keyboard shortcuts

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