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: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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