simplestore

package
v2.1.0-preview.4.5+inc... Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: CC0-1.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONSerializer

type JSONSerializer struct{}

JSONSerializer serializes an application to JSON for storage

func NewJSONSerializer

func NewJSONSerializer() JSONSerializer

NewJSONSerializer returns a new JSON Serializer

func (JSONSerializer) DeserializeApplication

func (s JSONSerializer) DeserializeApplication(accountID int, formType string, formVersion string, serializedBody []byte) (api.Application, error)

DeserializeApplication turns bytes into an Application

func (JSONSerializer) DeserializeAttachment

func (s JSONSerializer) DeserializeAttachment(accountID int, attachmentID int, metadata []byte, body []byte) (api.Attachment, error)

DeserializeAttachment turns bytes into an Attachment

func (JSONSerializer) SerializeApplication

func (s JSONSerializer) SerializeApplication(app api.Application) ([]byte, error)

SerializeApplication turns an Application into bytes for storage

func (JSONSerializer) SerializeAttachment

func (s JSONSerializer) SerializeAttachment(attachment api.Attachment) ([]byte, []byte, error)

SerializeAttachment turns an Attachment into bytes

type SimpleStore

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

SimpleStore saves JSON in the db for applications

func NewSimpleStore

func NewSimpleStore(connectionString string, logger api.LogService, serializer api.Serializer) (SimpleStore, error)

NewSimpleStore returns a configured SimpleStore

func (SimpleStore) CreateApplication

func (s SimpleStore) CreateApplication(app api.Application) error

CreateApplication saves an application in the db

func (SimpleStore) CreateAttachment

func (s SimpleStore) CreateAttachment(attachment *api.Attachment) error

CreateAttachment saves an attachment in the db

func (SimpleStore) DeleteApplication

func (s SimpleStore) DeleteApplication(accountID int) error

DeleteApplication deletes an application from the database

func (SimpleStore) DeleteAttachment

func (s SimpleStore) DeleteAttachment(accountID int, attachmentID int) error

DeleteAttachment deletes an attachment from the database

func (SimpleStore) ListAttachmentsMetadata

func (s SimpleStore) ListAttachmentsMetadata(accountID int) ([]api.Attachment, error)

ListAttachmentsMetadata loads an attachment from the database NOTE, it does not fetch the body of the attachments, just the metadata

func (SimpleStore) LoadApplication

func (s SimpleStore) LoadApplication(accountID int) (api.Application, error)

LoadApplication loads an application from the DB, it will return a NotFound error if it does not exist.

func (SimpleStore) LoadAttachment

func (s SimpleStore) LoadAttachment(accountID int, attachmentID int) (api.Attachment, error)

LoadAttachment loads an attachment from the database

func (SimpleStore) SaveSection

func (s SimpleStore) SaveSection(section api.Section, accountID int) error

SaveSection saves a single section in a given application

func (SimpleStore) UpdateApplication

func (s SimpleStore) UpdateApplication(app api.Application) error

UpdateApplication updates an existing application

Jump to

Keyboard shortcuts

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