db

package
v0.0.0-...-105b682 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

func Authorize

func Authorize(id, permission string) (bool, error)

auth

func CreateRole

func CreateRole(role *account.Role) error

func CreateUser

func CreateUser(user *account.User) error

func DeleteRole

func DeleteRole(id string) error

func DeleteUser

func DeleteUser(id string) error

func FindUser

func FindUser(email string) (*account.User, error)

account

func Init

func Init() error

func ReadAllRoles

func ReadAllRoles() ([]*account.Role, error)

func ReadRole

func ReadRole(id string) (*account.Role, error)

role

func ReadUser

func ReadUser(id string) (*account.User, error)

func Register

func Register(backend DB)

func SearchUsers

func SearchUsers(limit, offset int64) ([]*account.User, error)

func UpdateRole

func UpdateRole(role *account.Role) error

func UpdateUser

func UpdateUser(user *account.User) error

Types

type Account

type Account interface {
	FindUser(email string) (*account.User, error)
	ReadUser(id string) (*account.User, error)
	CreateUser(user *account.User) error
	UpdateUser(user *account.User) error
	DeleteUser(id string) error
	SearchUsers(limit, offset int64) ([]*account.User, error)
}

type Auth

type Auth interface {
	Authorize(id, permission string) (bool, error)
}

type DB

type DB interface {
	Init() error
	Account
	Role
	Auth
}

type Role

type Role interface {
	ReadRole(id string) (*account.Role, error)
	ReadAllRoles() ([]*account.Role, error)
	CreateRole(role *account.Role) error
	UpdateRole(role *account.Role) error
	DeleteRole(id string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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