repositories

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

exports repositories dependency

Functions

This section is empty.

Types

type AuthRepository

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

func NewAuthRepository

func NewAuthRepository(db lib.Database, logger lib.Logger) AuthRepository

NewAuthRepository initialize auth repository

func (AuthRepository) Get

func (ar AuthRepository) Get(key string) (string, error)

Get Redis `GET key` command. It returns redis.Nil error when key does not exist.

func (AuthRepository) Set

func (ar AuthRepository) Set(key, value string, expiration time.Duration) error

Set Redis `SET key value [expiration]` command.

type MemoRepository

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

func NewMemoRepository

func NewMemoRepository(db lib.Database, logger lib.Logger) MemoRepository

NewMemoRepository initialize memo repository

func (MemoRepository) Create

func (mr MemoRepository) Create(memo models.Memo) error

Create inserts the given memo.

func (MemoRepository) Delete

func (mr MemoRepository) Delete(conditions models.Memo) error

Delete deletes the memo matching the given conditions. but the conditions must contain an ID.

func (MemoRepository) FindAll

func (mr MemoRepository) FindAll(conditions models.Memo) ([]models.Memo, error)

FindAll finds all memos matching given conditions.

func (MemoRepository) FindOne

func (mr MemoRepository) FindOne(conditions models.Memo) (models.Memo, error)

FindOne finds the first memo ordered by ID, matching given conditions.

func (MemoRepository) Update

func (mr MemoRepository) Update(conditions models.Memo) error

Update updates the memo matching the given conditions. but the conditions must contain an ID.

type UserRepository

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

func NewUserRepository

func NewUserRepository(db lib.Database, logger lib.Logger) UserRepository

NewUserRepository initialize user repository

func (UserRepository) Create

func (ur UserRepository) Create(user models.User) error

Create inserts the given user.

func (UserRepository) Delete

func (ur UserRepository) Delete(conditions models.User) error

Delete deletes the user matching the given conditions. but the conditions must contain an ID.

func (UserRepository) Exists

func (ur UserRepository) Exists(conditions models.User) (bool, error)

Exists verify that at least one user matches the given conditions.

func (UserRepository) FindAll

func (ur UserRepository) FindAll(conditions models.User) ([]models.User, error)

FindAll finds all users matching given conditions.

func (UserRepository) FindOne

func (ur UserRepository) FindOne(conditions models.User) (models.User, error)

FindOne finds the first user ordered by ID, matching given conditions.

func (UserRepository) Update

func (ur UserRepository) Update(conditions models.User) error

Update updates the user matching the given conditions. but the conditions must contain an ID.

Jump to

Keyboard shortcuts

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