counter

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package counter handles the logic of a counter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository struct {
	*database.Queries
}

Repository wraps around a SQL database to execute the counter methods.

func NewRepository

func NewRepository(db *sql.DB) *Repository

NewRepository wraps around a SQL database to execute the counter methods.

func (*Repository) Get

func (r *Repository) Get(ctx context.Context, userID string) (int64, error)

Get the value of the counter of a user from the database.

func (*Repository) Inc

func (r *Repository) Inc(ctx context.Context, userID string) (newValue int64, err error)

Inc increments the counter of a user in the database by one.

Jump to

Keyboard shortcuts

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