persistence

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package persistence contains methods to store and retrieve content from Amazon DynamoDB.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllUsers

func GetAllUsers(client *dynamodb.DynamoDB) (users []structs.User, err error)

GetAllUsers returns all the users that didn't block the bot.

func GetRequestsSince

func GetRequestsSince(threshold int64, client *dynamodb.DynamoDB) (requests []structs.Request, err error)

GetRequestsSince returns the request that happened after a certain threshold. The threshold is given in Unix timestamp format.

func IsUserAdmin

func IsUserAdmin(userID int, client *dynamodb.DynamoDB) (isAdmin bool, err error)

IsUserAdmin returns true if the user's IsAdmin field is true.

func PutRequest

func PutRequest(userID int, url string, client *dynamodb.DynamoDB) error

PutRequest saves a request on DynamoDB.

func PutUser

func PutUser(userID int, client *dynamodb.DynamoDB) error

PutUser saves a user on DynamoDB or updates it if they had previously blocked the bot.

func UpdateUserBlockStatus

func UpdateUserBlockStatus(userID int, hasBlockedBot bool, client *dynamodb.DynamoDB) (err error)

UpdateUserBlockStatus updates the HasBlockedUser field according to the input flag.

Types

This section is empty.

Jump to

Keyboard shortcuts

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