service

package
v0.0.0-...-19f3120 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package service wraps user interfaces with common logic unrelated to any particular user implementation. All consumers should be using service.DataStore and not the naked repositories!

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStore

type DataStore struct {
	UserRepository user.Interface
	BCryptCost     int
}

DataStore wraps all stores with common and additional methods todo looks ugly, rewrite

func (*DataStore) AddUser

func (s *DataStore) AddUser(user store.User, password string) (id string, err error)

AddUser to the database, hash its password and give it an ID, if needed

func (*DataStore) CheckUserCredentials

func (s *DataStore) CheckUserCredentials(email string, password string) (ok bool, err error)

CheckUserCredentials with the given username and password

func (*DataStore) GetUserEmail

func (s *DataStore) GetUserEmail(id string) (email string, err error)

GetUserEmail returns the email of the specified user

func (*DataStore) GetUserPrivs

func (s *DataStore) GetUserPrivs(id string) (privs []store.Privilege, err error)

GetUserPrivs returns the list of privileges of the specified user

func (*DataStore) RegisterAdmin

func (s *DataStore) RegisterAdmin(email string, password string) (id string, err error)

RegisterAdmin in the database

Jump to

Keyboard shortcuts

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