types

package
v0.0.0-...-b09f343 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: BSD-3-Clause, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecordsFromQuote

func RecordsFromQuote(q *Quote) (*Record, []*Record)

RecordsFromQuote creates a quotes record metadata from the given quote

Types

type AFS

type AFS = afero.Afero

AFS ...

type AFSFile

type AFSFile = afero.File

AFSFile ...

type AWSAttrVal

type AWSAttrVal = dynamodb.AttributeValue

AWSAttrVal ...

type AWSAttrValMap

type AWSAttrValMap = []map[string]*dynamodb.AttributeValue

AWSAttrValMap ...

type AWSConditionBuilder

type AWSConditionBuilder = expression.ConditionBuilder

AWSConditionBuilder ...

type AWSConfig

type AWSConfig = aws.Config

AWSConfig ...

type AWSDynamoDB

type AWSDynamoDB = dynamodb.DynamoDB

AWSDynamoDB ...

type AWSGetItemInput

type AWSGetItemInput = dynamodb.GetItemInput

AWSGetItemInput ...

type AWSQueryInput

type AWSQueryInput = dynamodb.QueryInput

AWSQueryInput ...

type AWSSTSCreds

type AWSSTSCreds = credentials.Credentials

AWSSTSCreds ...

type AWSSession

type AWSSession = session.Session

AWSSession ...

type DBAV

type DBAV = dynamodb.AttributeValue

DBAV ...

type DBBatchGetIn

type DBBatchGetIn = dynamodb.BatchGetItemInput

DBBatchGetIn ...

type DBBatchGetOut

type DBBatchGetOut = dynamodb.BatchGetItemOutput

DBBatchGetOut ...

type DBExpr

type DBExpr = expression.Expression

DBExpr ...

type DBGetIn

type DBGetIn = dynamodb.GetItemInput

DBGetIn ...

type DBGetOut

type DBGetOut = dynamodb.GetItemOutput

DBGetOut ...

type DBIFace

type DBIFace = dynamodbiface.DynamoDBAPI

DBIFace ...

type DBQueryIn

type DBQueryIn = dynamodb.QueryInput

DBQueryIn ...

type DBQueryOut

type DBQueryOut = dynamodb.QueryOutput

DBQueryOut ...

type DBTxWrIn

DBTxWrIn ...

type DBTxWrItem

type DBTxWrItem = dynamodb.TransactWriteItem

DBTxWrItem ...

type DBTxWrOut

DBTxWrOut ...

type GetBatch

type GetBatch struct {
	Name  string `validate:"regexp=^(author|topic)$"`
	Value string `validate:"min=3,max=20,regexp=^[a-zA-Z0-9 ]*$"`
	Start *Record
}

GetBatch represents the client request for a batch of quotes with attribute

func NewGetBatch

func NewGetBatch() *GetBatch

type MultiQuoteRes

type MultiQuoteRes struct {
	Type   string
	Quotes []*Quote
	Next   *Record
	Err    error `json:"error"`
}

MultiQuoteRes forms the json response containing multiple quotes

func NewMultiQuoteRes

func NewMultiQuoteRes() *MultiQuoteRes

NewMultiQuoteRes returns a new MultiQuoteRes

func (*MultiQuoteRes) Error

func (m *MultiQuoteRes) Error() string

Error returns the string representation of the QuoteRes error field

func (*MultiQuoteRes) JSON

func (m *MultiQuoteRes) JSON() []byte

JSON return a byte slice containing the JSON representation of the MultiQuoteRes

func (*MultiQuoteRes) MarshalZerologObject

func (m *MultiQuoteRes) MarshalZerologObject(e *ZLEvent)

MarshalZerologObject logs the given object to zerolog

func (*MultiQuoteRes) WithErr

func (m *MultiQuoteRes) WithErr(e error) *MultiQuoteRes

WithErr inserts an error into the MultiQuoteRes

func (*MultiQuoteRes) WithNext

func (m *MultiQuoteRes) WithNext(r *Record) *MultiQuoteRes

WithNext inserts a next token into the MultiQuoteRes

func (*MultiQuoteRes) WithQuotes

func (m *MultiQuoteRes) WithQuotes(q []*Quote) *MultiQuoteRes

WithQuotes inserts quotes into the MultiQuoteRes

type Quote

type Quote struct {
	ID     string   `validate:"max=0"`
	Text   string   `validate:"min=5,max=100"`
	Author string   `validate:"min=5,max=20,regexp=^[a-zA-Z ]*$"`
	Topics []string `validate:"max=5,topics" dynamodbav:",stringset"`
}

Quote models an individual quote by an author, related to a set of topics

func NewQuote

func NewQuote() *Quote

NewQuote returns a new Quote

func (*Quote) GenerateID

func (q *Quote) GenerateID()

GenerateID inserts an ID = SHA1(Author+Text) into the Quote

func (*Quote) NewID

func (q *Quote) NewID() *Quote

NewID inserts a new UUID into a Quote

func (*Quote) WithAuthor

func (q *Quote) WithAuthor(a string) *Quote

WithAuthor inserts the given author into a Quote

func (*Quote) WithID

func (q *Quote) WithID(id string) *Quote

WithID inserts the given ID into a Quote

func (*Quote) WithText

func (q *Quote) WithText(t string) *Quote

WithText inserts the given text into a Quote

func (*Quote) WithTopics

func (q *Quote) WithTopics(t []string) *Quote

WithTopics inserts the given topics into a Quote

type QuoteRes

type QuoteRes struct {
	Type  string
	Quote *Quote
	Err   error `json:"error"`
}

QuoteRes forms the json response containing a quote

func NewQuoteRes

func NewQuoteRes() *QuoteRes

NewQuoteRes returns a new QuoteRes

func (*QuoteRes) Error

func (q *QuoteRes) Error() string

Error returns the string representation of the QuoteRes error field

func (*QuoteRes) JSON

func (q *QuoteRes) JSON() []byte

JSON return a byte slice containing the JSON representation of the QuoteRes

func (*QuoteRes) MarshalZerologObject

func (q *QuoteRes) MarshalZerologObject(e *ZLEvent)

MarshalZerologObject logs the given object to zerolog

func (*QuoteRes) WithErr

func (q *QuoteRes) WithErr(err error) *QuoteRes

WithErr inserts an error into the QuoteRes

func (*QuoteRes) WithQuote

func (q *QuoteRes) WithQuote(quote *Quote) *QuoteRes

WithQuote inserts a quote into the QuoteRes

type Record

type Record struct {
	Name    string `validate:"min=3,max=20,regexp=^[a-zA-Z0-9 ]*$" json:"Name"`
	QuoteID string `validate:"min=3,max=20,regexp=^[a-zA-Z0-9 ]*$" json:"QuoteID"`
}

Record models a piece of quote metadata and its relation to quotes

func NewRecord

func NewRecord() *Record

NewRecord returns a new Record

func (*Record) WithName

func (r *Record) WithName(name string) *Record

WithName inserts a given name into the Record

func (*Record) WithQuoteID

func (r *Record) WithQuoteID(id string) *Record

WithQuoteID inserts a new quote id into the Record

type ZLEvent

type ZLEvent = zerolog.Event

ZLEvent ...

type ZLog

type ZLog = zerolog.Logger

ZLog ...

Jump to

Keyboard shortcuts

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