ds

package
v0.0.0-...-b75d32b Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const RoleAdmin = "admin"

Variables

This section is empty.

Functions

func GetVolunteerId

func GetVolunteerId(demonstrationId string, userId string) string

func IsAdmin

func IsAdmin(dsc Client, phone string) (bool, error)

func IsNoSuchEntityError

func IsNoSuchEntityError(err error) bool

Types

type Client

type Client interface {
	Get(kind Kind, id string, dst interface{}) error
	GetAll(kind Kind, dst interface{}) error
	GetFilter(kind Kind, filters []FilterField, dst interface{}) error
	Put(kind Kind, id string, src interface{}) error
	Delete(kind Kind, id string) error
}

func NewClientWrapper

func NewClientWrapper(project string) Client

func NewInMemoryClient

func NewInMemoryClient() Client

type ClientWrapper

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

func (*ClientWrapper) Delete

func (c *ClientWrapper) Delete(kind Kind, id string) error

func (*ClientWrapper) Get

func (c *ClientWrapper) Get(kind Kind, id string, dst interface{}) error

func (*ClientWrapper) GetAll

func (c *ClientWrapper) GetAll(kind Kind, dst interface{}) error

func (*ClientWrapper) GetFilter

func (c *ClientWrapper) GetFilter(kind Kind, filters []FilterField, dst interface{}) error

func (*ClientWrapper) Put

func (c *ClientWrapper) Put(kind Kind, id string, src interface{}) error

type Demonstration

type Demonstration struct {
	Id   string `json:"id" datastore:"id"`
	Name string `json:"name" datastore:"name"`
}

func GetKaplanDemonstration

func GetKaplanDemonstration(dsc Client) (*Demonstration, error)

type FilterField

type FilterField struct {
	Name     string
	Operator string
	Value    interface{}
}

type InMemoryClient

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

func (*InMemoryClient) Delete

func (c *InMemoryClient) Delete(kind Kind, id string) error

func (*InMemoryClient) Get

func (c *InMemoryClient) Get(kind Kind, id string, dst interface{}) error

func (*InMemoryClient) GetAll

func (c *InMemoryClient) GetAll(kind Kind, dst interface{}) error

func (*InMemoryClient) GetFilter

func (c *InMemoryClient) GetFilter(kind Kind, filters []FilterField, dst interface{}) error

func (*InMemoryClient) Put

func (c *InMemoryClient) Put(kind Kind, id string, src interface{}) error

func (*InMemoryClient) SetGetFilterDelegate

func (c *InMemoryClient) SetGetFilterDelegate(delegate func(kind Kind, filters []FilterField, dst interface{}) error)

type Kind

type Kind string
const (
	KindObservation     Kind = "observation"
	KindRegisterRequest Kind = "register_request"
	KindUser            Kind = "user"
	KindVolunteer       Kind = "volunteer"
	KindPreference      Kind = "preference"
	KindDemonstration   Kind = "demonstration"

	DemonstrationKaplan = "kaplan"

	EnvKeyDatastoreToken = "DATASTORE_KEY"
)

type Observation

type Observation struct {
	Time          int64   `json:"time" datastore:"time"`
	User          string  `json:"user_id" datastore:"user_id"`
	Demonstration string  `json:"demonstration" datastore:"demonstration"`
	Polygon       string  `json:"polygon" datastore:"polygon"`
	Density       float32 `json:"density" datastore:"density"`
	Latitude      float32 `json:"latitude" datastore:"latitude"`
	Longitude     float32 `json:"longitude" datastore:"longitude"`
}

func GetObservations

func GetObservations(dsc Client, demonstration string) ([]Observation, error)

type User

type User struct {
	Id         string `json:"id" datastore:"id"`
	Phone      string `json:"phone" datastore:"phone"`
	Name       string `json:"name" datastore:"name"`
	Preference string `json:"preference" datastore:"preference"`
	Time       int64  `json:"time" datastore:"time"`
	Role       string `json:"role" datastore:"role"`
}

func GetUserByPhone

func GetUserByPhone(dsc Client, phone string) (*User, error)

type Volunteer

type Volunteer struct {
	UserId          string `json:"user_id" datastore:"user_id"`
	DemonstrationId string `json:"demonstration_id" datastore:"demonstration_id"`
	Polygon         string `json:"polygon" datastore:"polygon"`
	Location        string `json:"location" datastore:"location"`
	Time            int64  `json:"time" datastore:"time"`
}

func GetVolunteers

func GetVolunteers(dsc Client, demonstration string) ([]Volunteer, error)

Jump to

Keyboard shortcuts

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