database

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ACCOUNTS_TABLE    = "accounts"
	DEVICES_TABLE     = "devices"
	ACCOUNTS_GSI_NAME = "username-index"
	DEVICES_GSI_NAME  = "account-id-index"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	AccountId string   `dynamodbav:"account-id"` // TODO: unmarshal into our own UUID type
	Emails    []string `dynamodbav:"emails"`
	Username  string   `dynamodbav:"username"`
	Password  string   `dynamodbav:"password"`
}

account represents an 'accounts' table entry

type Client

type Client interface {
	GetDeviceById(id string) (*Device, error)
	GetAccountById(id string) (*Account, error)
	GetAccountByUsername(username string) (*Account, error)
	GetDevicesByAccount(id string) ([]Device, error)
	UpdateAccountEmails(accountId string, emails []string) (*Account, error)
}

Client is a client for interfacing with a detectordag database

func New

func New(sesh *session.Session) (Client, error)

New gets a new Client

type Device

type Device struct {
	Name      string `dynamodbav:"name"`
	DeviceId  string `dynamodbav:"device-id"`
	AccountId string `dynamodbav:"account-id"`
}

device is a 'device' table row

Jump to

Keyboard shortcuts

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