Documentation ¶
Index ¶
- func HashPassword(plainPwd string) (string, error)
- type Books
- type BooksClient
- func (c *BooksClient) AddBook(ctx context.Context, book *model.Book) error
- func (c *BooksClient) DeleteBook(ctx context.Context, id string) (int, error)
- func (c *BooksClient) GetBook(ctx context.Context, id string) (model.Book, error)
- func (c *BooksClient) InitBooks(ctx context.Context)
- func (c *BooksClient) ListBooks(ctx context.Context) ([]model.Book, error)
- func (c *BooksClient) SearchBooks(ctx context.Context, tag string) ([]model.Book, error)
- func (c *BooksClient) UpdateBook(ctx context.Context, id string, book model.Book) (int, error)
- type CookieStoreClient
- type Redis
- type RedisClient
- func (c *RedisClient) DeleteEntry(ctx context.Context, id string)
- func (c *RedisClient) GetBook(ctx context.Context, id string) (model.Book, error)
- func (c *RedisClient) GetBooks(ctx context.Context) ([]model.Book, error)
- func (c *RedisClient) SetBook(ctx context.Context, id string, book model.Book) error
- func (c *RedisClient) SetBooks(ctx context.Context, books []model.Book) error
- type Users
- type UsersClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashPassword ¶
Types ¶
type Books ¶
type Books interface { AddBook(ctx context.Context, book *model.Book) error ListBooks(ctx context.Context) ([]model.Book, error) SearchBooks(ctx context.Context, tag string) ([]model.Book, error) GetBook(ctx context.Context, id string) (model.Book, error) UpdateBook(ctx context.Context, id string, book model.Book) (int, error) DeleteBook(ctx context.Context, id string) (int, error) }
type BooksClient ¶
type BooksClient struct {
// contains filtered or unexported fields
}
BooksClient is the client responsible for querying mongodb
func NewBooksClient ¶
func NewBooksClient(client *mongo.Client, cfg *viper.Viper) *BooksClient
func (*BooksClient) DeleteBook ¶
DeleteBook wrapper to delete a book from the MongoDB collection
func (*BooksClient) InitBooks ¶
func (c *BooksClient) InitBooks(ctx context.Context)
func (*BooksClient) SearchBooks ¶
SearchBooks wrapper to return all books based on a 'tag' from the MongoDB collection
func (*BooksClient) UpdateBook ¶
type CookieStoreClient ¶
CookieStoreClient is the client responsible for managing cookies
func (CookieStoreClient) NewCookieStore ¶
func (c CookieStoreClient) NewCookieStore() (redisStore.Store, error)
type RedisClient ¶
type RedisClient struct {
// contains filtered or unexported fields
}
RedisClient is the client responsible for querying redis
func NewRedisClient ¶
func NewRedisClient(client *redis.Client, cfg *viper.Viper) *RedisClient
func (*RedisClient) DeleteEntry ¶
func (c *RedisClient) DeleteEntry(ctx context.Context, id string)
DeleteEntry wrapper to delete a book entry from Redis
type UsersClient ¶
type UsersClient struct {
// contains filtered or unexported fields
}
BooksClient is the client responsible for querying mongodb
func NewUsersClient ¶
func NewUsersClient(client *mongo.Client, cfg *viper.Viper) *UsersClient
NewUsersClient create a new UsersClient
func (*UsersClient) Get ¶
func (c *UsersClient) Get(ctx context.Context, username string, password string) (model.User, error)
Get returns a user by username
func (*UsersClient) InitUsers ¶
func (c *UsersClient) InitUsers(ctx context.Context)
Click to show internal directories.
Click to hide internal directories.