models

package
v0.0.0-...-605c8b4 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const TABLE_NAME = "Comments"

Variables

View Source
var DISTRIBUTION_ID string

Functions

func CreateCFClient

func CreateCFClient() *cloudfront.Client

func CreateClient

func CreateClient() *dynamodb.Client

func CreateLocalClient

func CreateLocalClient() *dynamodb.Client

func CreateProdClient

func CreateProdClient() *dynamodb.Client

func CreateTable

func CreateTable(d *dynamodb.Client) error

func CreateTableIfNotExists

func CreateTableIfNotExists(d *dynamodb.Client) error

func InvalidateCommentCache

func InvalidateCommentCache(cf *cloudfront.Client, path string) error

func ListComments

func ListComments(d *dynamodb.Client, url string) (*[]Comment, error)

Types

type Comment

type Comment struct {
	ID         uuid.UUIDv7 `dynamodbav:"id" json:"id"`
	Email      string      `dynamodbav:"email" json:"-"`
	Body       string      `dynamodbav:"body" json:"body"`
	Signature  string      `dynamodbav:"signature" json:"signature"`
	Url        string      `dynamodbav:"url" json:"url"`
	Website    *string     `dynamodbav:"website" json:"website"`
	InsertedAt int64       `dynamodbav:"insertedAt" json:"insertedAt"`
}

func CreateComment

func CreateComment(d *dynamodb.Client, input *CreateCommentInput) (*Comment, error)

func (Comment) MarshalJSON

func (c Comment) MarshalJSON() ([]byte, error)

type CreateCommentInput

type CreateCommentInput struct {
	Body      string  `json:"body"`
	Signature string  `json:"signature"`
	Url       string  `json:"url"`
	Website   *string `json:"website"`
	Email     string  `json:"email"`
	IAmARobot bool    `json:"iAmARobot"`
}

func (*CreateCommentInput) Validate

func (p *CreateCommentInput) Validate() []string

Jump to

Keyboard shortcuts

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