Documentation ¶
Index ¶
- func ExtractCategoryType(s string) string
- func FormCategoryResponse(summaries []ExtCategory) (events.APIGatewayProxyResponse, error)
- func FormResponse(summaries []ExtPic) (events.APIGatewayProxyResponse, error)
- func PKQuery(pkName string) *dynamodb.QueryInput
- func SplitActiveCategory(s string) (category string, active string)
- type Category
- type ExtCategory
- type ExtPic
- type Picture
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractCategoryType ¶
ExtractCategoryType splits the gsi_2_sk for pictures (e.g. Galerie_t_Ferne) to get the first part
func FormCategoryResponse ¶
func FormCategoryResponse(summaries []ExtCategory) (events.APIGatewayProxyResponse, error)
FormCategoryResponse is a helper function to create an APIGateway response
func FormResponse ¶
func FormResponse(summaries []ExtPic) (events.APIGatewayProxyResponse, error)
FormResponse is a helper function to create an APIGateway response
if err is not null they somehow throw away the apigatewayproxyresponse object, including the eventual header, which might lead to CORS problems..
func PKQuery ¶
func PKQuery(pkName string) *dynamodb.QueryInput
PKQuery is a helper function to only query the partition key
func SplitActiveCategory ¶
SplitActiveCategory splits the gsi_1_pk for pictures (e.g. Ferne_t) in two strings so they can be returned seperately to the frontend
Types ¶
type Category ¶
type Category struct { UUID string `json:"pk"` Category string `json:"gsi_1_pk"` Type string `json:"gsi_3_pk"` CategoryType string `json:"gsi_4_pk"` }
Category holds all fields of a category db entry
func CategoryQueryDynamoDB ¶
func CategoryQueryDynamoDB(ctx context.Context, qi *dynamodb.QueryInput, sess *session.Session) ([]Category, error)
CategoryQueryDynamoDB is a helper that takes a query input and returns a struct
func FormatCategory ¶
func FormatCategory(ec ExtCategory) (c Category)
FormatCategory transforms the data from dynamodb to a format the frontend can handle
type ExtCategory ¶
type ExtCategory struct { UUID string `json:"uuid"` Category string `json:"name"` CategoryType string `json:"type_name"` }
ExtCategory holds all fields of a category db entry
func FormatExtCategory ¶
func FormatExtCategory(categories []Category) []ExtCategory
FormatExtCategory transforms the data from dynamodb to a format the frontend can handle
type ExtPic ¶
type ExtPic struct { UUID string `json:"uuid"` Category string `json:"category_name"` CategoryType string `json:"category_type_name"` Order int `json:"order"` FrontPage string `json:"front_page"` Description string `json:"description"` Title string `json:"title"` URL string `json:"url"` Active string `json:"active"` }
ExtPic is the format the frontend recieves and expects
func FormatExtPic ¶
FormatExtPic transforms the data from dynamodb to a format the frontend can handle
type Picture ¶
type Picture struct { UUID string `json:"pk"` ActiveCategory string `json:"gsi_1_pk"` Order int `json:"gsi_1_sk_2_pk"` ActiveCategoryType string `json:"gsi_2_sk"` Type string `json:"gsi_3_pk"` FrontPage string `json:"gsi_4_pk"` Description string `json:"gsi_4_sk"` Title string `json:"title"` URL string `json:"url"` }
Picture holds all fields of a picture db entry
func QueryDynamoDB ¶
func QueryDynamoDB(ctx context.Context, qi *dynamodb.QueryInput, sess *session.Session) ([]Picture, error)
QueryDynamoDB is a helper that takes a query input and returns a struct