store

package
v0.0.0-...-af044e7 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(id string) error

Delete deletes the entire item the an id of 'id'

func DeleteVars

func DeleteVars(id, variables string) error

DeleteVars deletes the given variables from the item with id of id

func DeleteVarsFromFile

func DeleteVarsFromFile(id, filePath string) error

DeleteVarsFromFile deletes the variables found in the file filepath

func Init

func Init(regionName, table string)

Init sets up connection to dynamodb. This must be called before using any other functions in the store package.

func Save

func Save(id, vars string) error

Save saves env vars given a string of vars in form of this=that,this2=that2

func SaveFromFile

func SaveFromFile(id, fileName string) error

SaveFromFile gets env vars from a env file and saves to dynamo

func SetDB

func SetDB(newDB dynamodbiface.DynamoDBAPI)

SetDB allows user to set db. Created for testing mostly

func Update

func Update(id, vars string) error

Update updates configurate of given application with id

func UpdateFromFile

func UpdateFromFile(id, fileName string) error

UpdateFromFile updates stuff from a file

Types

type DynamodbItem

type DynamodbItem struct {
	Key   string `dynamodbav:"key"`
	Value string `dynamodbav:"value"`
}

DynamodbItem is not what we want?

type Item

type Item struct {
	ID        string     `dynamodbav:"id" json:"id"`
	Variables []Variable `dynamodbav:"variables" json:"variables"`
}

Item is the format of the configuratoin stored in dynamodb

func CreateItem

func CreateItem(id string, variables []Variable) Item

CreateItem creates an item

func Get

func Get(id string) (Item, error)

Get gets the item that has an id of 'id'

func (*Item) PrintVars

func (item *Item) PrintVars(format string)

PrintVars prints the variables in the item

func (*Item) String

func (item *Item) String() string

type Variable

type Variable struct {
	Name  string `dynamodbav:"name" json:"name"`
	Value string `dynamodbav:"value" json:"value"`
}

Variable is a piece of configuration

Jump to

Keyboard shortcuts

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