model

package
v0.0.0-...-09e72e1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package model deals with specific models for dynamodb(they might be a bit different to db/model). It allows for sorting of the given models and transformation to db/model equivalents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	Id        uuid.UUID `dynamo:"ID,hash"`
	ThreadId  uuid.UUID `dynamo:"ThreadId" index:"ThreadId_index,hash"`
	Body      string    `dynamo:"Body"`
	Author    string    `dynamo:"Author"`
	Confirmed bool      `dynamo:"Confirmed"`
	CreatedAt time.Time `dynamo:"CreatedAt"`
	DeletedAt *int64    `dynamo:"DeletedAt,omitempty"`
	ReplyTo   *string   `dynamo:"ReplyTo,omitempty"`
}

Comment represents a comment in a thread

func (*Comment) FromComment

func (c *Comment) FromComment(input model.Comment)

FromComment converts mouthful comment object to dynamodb comment

func (*Comment) ToComment

func (c *Comment) ToComment() (model.Comment, error)

ToComment converts dynamoDb comment object to mouthful comment

type CommentSlice

type CommentSlice []Comment

CommentSlice represents a collection of comments

func (CommentSlice) Len

func (cs CommentSlice) Len() int

func (CommentSlice) Less

func (cs CommentSlice) Less(i, j int) bool

func (CommentSlice) Swap

func (cs CommentSlice) Swap(i, j int)

type Thread

type Thread struct {
	Id        uuid.UUID `dynamo:"ID"`
	Path      string    `dynamo:"Path,hash"`
	CreatedAt time.Time `dynamo:"CreatedAt"`
}

Thread represents a commenting thread for dynamodb. This is needed since we store threads a bit differently than in a relational database

func (*Thread) ToThread

func (t *Thread) ToThread() model.Thread

ToThread converts dynamodb thread to mouthful thread

type ThreadSlice

type ThreadSlice []Thread

ThreadSlice represents a collection of threads

func (ThreadSlice) Len

func (ts ThreadSlice) Len() int

func (ThreadSlice) Less

func (ts ThreadSlice) Less(i, j int) bool

func (ThreadSlice) Swap

func (ts ThreadSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

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