service

package
v1.5.7-0...-b5473c1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptRegister

func OptRegister(name string, bf BootFunc)

Types

type BootFunc

type BootFunc func(opts model.Opts) error

type Mail

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

func NewMail

func NewMail() *Mail

func (*Mail) Boot

func (m *Mail) Boot(opt model.Opts) error

func (*Mail) Enabled

func (m *Mail) Enabled() bool

func (*Mail) NotifyActive

func (m *Mail) NotifyActive(siteAddr, email string, token string) error

func (*Mail) NotifyPasswordReset

func (m *Mail) NotifyPasswordReset(siteAddr, email, token string) error

type Option

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

func NewOption

func NewOption() *Option

func (*Option) Update

func (o *Option) Update(name string, p model.Opts) error

type RecycleBin

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

func NewRecycleBin

func NewRecycleBin() *RecycleBin

func (*RecycleBin) Clean

func (rb *RecycleBin) Clean(uid, sid int64) error

func (*RecycleBin) Delete

func (rb *RecycleBin) Delete(uid int64, alias string) error

func (*RecycleBin) FindAll

func (rb *RecycleBin) FindAll(uid int64, sid int64, offset int, limit int) (list []model.Recycle, total int64, err error)

func (*RecycleBin) Recovery

func (rb *RecycleBin) Recovery(uid int64, alias string) error

type RoleClaims

type RoleClaims struct {
	jwt.StandardClaims

	Roles []string `json:"roles"`
}

func NewRoleClaims

func NewRoleClaims(subject string, ttl int, roles []string) *RoleClaims

func (*RoleClaims) Uid

func (rc *RoleClaims) Uid() int64

type Storage

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

func NewStorage

func NewStorage() *Storage

func (*Storage) Create

func (s *Storage) Create(storage *model.Storage) error

func (*Storage) Get

func (s *Storage) Get(id interface{}) (*model.Storage, error)

fixme: 单元测试mock侵入了业务代码,有没有更好的办法?

func (*Storage) GetProvider

func (s *Storage) GetProvider(id interface{}) (provider.Provider, error)

fixme: 单元测试mock侵入了业务代码,有没有更好的办法?

func (*Storage) GetProviderByStorage

func (s *Storage) GetProviderByStorage(storage *model.Storage) (provider.Provider, error)

fixme: 单元测试mock侵入了业务代码,有没有更好的办法?

type Token

type Token struct {
}

func NewToken

func NewToken() *Token

func (*Token) Create

func (s *Token) Create(uid string, ttl int, roles ...string) (string, error)

func (*Token) Verify

func (s *Token) Verify(tokenStr string) (*RoleClaims, error)

type User

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

func NewUser

func NewUser() *User

func (*User) Active

func (u *User) Active(token string) error

func (*User) InviteRequired

func (u *User) InviteRequired() bool

func (*User) PasswordReset

func (u *User) PasswordReset(token, password string) error

func (*User) PasswordResetApply

func (u *User) PasswordResetApply(origin, email string) error

func (*User) PasswordUpdate

func (u *User) PasswordUpdate(uid int64, oldPwd, newPwd string) error

func (*User) SignIn

func (u *User) SignIn(usernameOrEmail, password string, ttl int) (*model.User, error)

func (*User) SignOut

func (u *User) SignOut()

func (*User) Signup

func (u *User) Signup(email, password string, opt model.UserCreateOption) (*model.User, error)

Jump to

Keyboard shortcuts

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