Version: v0.0.0-...-b472bfd Latest Latest

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

Go to latest
Published: Jul 27, 2021 License: Apache-2.0 Imports: 6 Imported by: 0



Package advisory provides support for managing advisory data in the database.



This section is empty.


View Source
var (
	ErrNotFound = errors.New("advisory not found")

Set of error variables for CRUD operations.


This section is empty.


type Advisory

type Advisory struct {
	ID          string  `json:"id,omitempty"`
	City        City    `json:"city"`
	Country     string  `json:"country"`
	CountryCode string  `json:"country_code"`
	Continent   string  `json:"continent"`
	Score       float64 `json:"score"`
	LastUpdated string  `json:"last_updated"`
	Message     string  `json:"message"`
	Source      string  `json:"source"`

Advisory contains the travel advisory result captured for a city.

type City

type City struct {
	ID string `json:"id"`

City is used to capture the city id in relationships.

type Store

type Store struct {
	// contains filtered or unexported fields

Store manages the set of API's for advisory access.

func NewStore

func NewStore(log *log.Logger, gql *graphql.GraphQL) Store

NewStore constructs a advisory store for api access.

func (Store) QueryByCity

func (s Store) QueryByCity(ctx context.Context, traceID string, cityID string) (Advisory, error)

QueryByCity returns the specified advisory from the database by the city id.

func (Store) Replace

func (s Store) Replace(ctx context.Context, traceID string, adv Advisory) (Advisory, error)

Replace replaces an advisory in the database and connects it to the specified city.

Jump to

Keyboard shortcuts

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