userdb

package
v0.0.0-...-ac0e98d Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package userdb contains user related CRUD functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store manages the set of APIs for user database access.

func NewStore

func NewStore(log *zerolog.Logger, db *sqlx.DB) *Store

NewStore constructs the api for data access.

func (*Store) Create

func (s *Store) Create(usr user.User) error

Create inserts a new user into the database.

func (*Store) Delete

func (s *Store) Delete(usr user.User) error

Delete removes a user from the database.

func (*Store) Query

func (s *Store) Query(pageNumber int, rowsPerPage int) ([]user.User, error)

Query retrieves a list of existing users from the database.

func (*Store) QueryByEmail

func (s *Store) QueryByEmail(email string) (user.User, error)

QueryByEmail gets the specified user from the database by email.

func (*Store) QueryByID

func (s *Store) QueryByID(id uuid.UUID) (user.User, error)

QueryByID gets the specified user from the database by id.

func (*Store) QueryByTopicID

func (s *Store) QueryByTopicID(topicID uuid.UUID) ([]user.User, error)

func (*Store) Update

func (s *Store) Update(usr user.User) error

Update replaces a user document in the database.

func (*Store) WithinTran

func (s *Store) WithinTran(fn func(user.Storer) error) error

WithinTran runs passed function and do commit/rollback at the end.

Jump to

Keyboard shortcuts

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