db

package
v0.0.0-...-b04ede0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package db provides database operations and data structures

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	DB *dynamodb.DynamoDB
}

Client provides DynamoDB client data

func NewClient

func NewClient() (*Client, error)

NewClient insantiates new DynamoDB client

func (*Client) CountStickers

func (client *Client) CountStickers(userID int64) (int64, error)

CountStickers counts user's stickers

func (*Client) DeleteSticker

func (client *Client) DeleteSticker(sticker Sticker) error

DeleteSticker removes a sticker

func (*Client) GetStickers

func (client *Client) GetStickers(userID int64) (Stickers, error)

GetStickers gets a list of stickers by user id

func (*Client) PutSticker

func (client *Client) PutSticker(sticker Sticker) error

PutSticker inserts a sticker into table

func (*Client) StickerBelongsToUser

func (client *Client) StickerBelongsToUser(
	userID int64,
	sticker Sticker,
) (bool, error)

StickerBelongsToUser checks if user has a sticker

func (*Client) UseSticker

func (client *Client) UseSticker(sticker Sticker) error

UseSticker increments UseCount of a sticker

type Sticker

type Sticker struct {
	UserID       int64
	FileUniqueID string
	FileID       string
	Timestamp    string
	UseCount     uint
}

Sticker provides info about sticker

type Stickers

type Stickers []Sticker

Stickers provides a slice of stickers

func (Stickers) Len

func (s Stickers) Len() int

Len returns a number of stickers

func (Stickers) Less

func (s Stickers) Less(i, j int) bool

Less checks if a first sticker should be shown before a second one

func (Stickers) Swap

func (s Stickers) Swap(i, j int)

Swap swaps two stickers

Jump to

Keyboard shortcuts

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