repository

package
v0.0.0-...-3fe7dee Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamoCheck

type DynamoCheck struct {
	PK             string
	SK             string
	CheckDateLSISK string
	HabitID        string `dynamodbav:"HabitUUID"`
	Date           string
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

func NewDynamoCheck

func NewDynamoCheck(userID auth.UserID, habitID, date string) *DynamoCheck

func (*DynamoCheck) GetKey

func (h *DynamoCheck) GetKey() map[string]types.AttributeValue

GetKey returns the composite primary key of the check in a format that can be sent to DynamoDB.

type DynamoHabit

type DynamoHabit struct {
	PK          string
	SK          string
	ID          string `dynamodbav:"UUID"`
	UserID      auth.UserID
	Title       string
	ChecksCount int
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func NewArchivedDynamoHabit

func NewArchivedDynamoHabit(userID auth.UserID, habitID string) *DynamoHabit

func NewDynamoHabit

func NewDynamoHabit(userID auth.UserID, habitID string) *DynamoHabit

func (*DynamoHabit) GetKey

func (h *DynamoHabit) GetKey() map[string]types.AttributeValue

GetKey returns the composite primary key of the habit in a format that can be sent to DynamoDB.

type DynamoRepository

type DynamoRepository struct {
	Client    *dynamodb.Client
	TableName string
}

func (*DynamoRepository) AllArchivedHabits

func (r *DynamoRepository) AllArchivedHabits(ctx context.Context, uid auth.UserID) ([]*DynamoHabit, error)

func (*DynamoRepository) AllHabits

func (r *DynamoRepository) AllHabits(ctx context.Context, uid auth.UserID) ([]*DynamoHabit, error)

func (*DynamoRepository) ArchiveHabit

func (r *DynamoRepository) ArchiveHabit(ctx context.Context, uid auth.UserID, hid string) error

func (*DynamoRepository) CreateCheck

func (r *DynamoRepository) CreateCheck(ctx context.Context, uid auth.UserID, hid, date string) (*DynamoCheck, error)

func (*DynamoRepository) CreateHabit

func (r *DynamoRepository) CreateHabit(ctx context.Context, uid auth.UserID, title string) (*DynamoHabit, error)

func (*DynamoRepository) DeleteCheck

func (r *DynamoRepository) DeleteCheck(ctx context.Context, uid auth.UserID, hid, date string) error

func (*DynamoRepository) DeleteHabit

func (r *DynamoRepository) DeleteHabit(ctx context.Context, uid auth.UserID, hid string) error

func (*DynamoRepository) FindArchivedHabit

func (r *DynamoRepository) FindArchivedHabit(ctx context.Context, uid auth.UserID, hid string) (*DynamoHabit, error)

func (*DynamoRepository) FindHabit

func (r *DynamoRepository) FindHabit(ctx context.Context, uid auth.UserID, hid string) (*DynamoHabit, error)

func (*DynamoRepository) ListLastWeekChecksInAllHabits

func (r *DynamoRepository) ListLastWeekChecksInAllHabits(ctx context.Context, uid auth.UserID) ([]*DynamoCheck, error)

func (*DynamoRepository) ListLatestChecksWithLimit

func (r *DynamoRepository) ListLatestChecksWithLimit(ctx context.Context, uid auth.UserID, hid string, limit int32) ([]*DynamoCheck, error)

func (*DynamoRepository) UnarchiveHabit

func (r *DynamoRepository) UnarchiveHabit(ctx context.Context, uid auth.UserID, hid string) error

func (*DynamoRepository) UpdateHabit

type DynamoRepositoryUpdateHabitInput

type DynamoRepositoryUpdateHabitInput struct {
	UserID  auth.UserID
	HabitID string
	Title   string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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