account

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package pkg comments for pkg account account 管理后台相关功能

Index

Constants

View Source
const (
	EmailHostEnv     = "EmailHost"
	EmailUserEnv     = "EmailUser"
	EmailPasswordEnv = "EmailPassword"
)

Variables

This section is empty.

Functions

func AdminNodeTypes

func AdminNodeTypes() (*types.ResultNodeTypes, error)

func CreateAdminNodeType

func CreateAdminNodeType(opt *adminNodeTypeOption) error

func LoginAuth

func LoginAuth(username, password string) smtp.Auth

func NewOption

func NewOption(fs ...SetOption) (*option, error)

func SendToMail

func SendToMail(user, password, host, to, subject, body, mailtype, replyToAddress string) error

Types

type Account

type Account struct {
	ID          int64     `json:"id"`
	Mail        string    `json:"mail"`        // mail
	Name        string    `json:"name"`        // name
	Avatar      string    `json:"avatar"`      // avatar
	Description string    `json:"description"` // description
	Status      int64     `json:"status"`      // status
	CreatedAt   time.Time `json:"created_at"`  // created_at
	// contains filtered or unexported fields
}

func CreateAccount

func CreateAccount(mail, password string) (*Account, error)

func List

func List(offset, limit int64) ([]*Account, error)

func RetrieveAccountByID

func RetrieveAccountByID(id int64) (*Account, error)

func RetrieveAccountByMail

func RetrieveAccountByMail(mail string) (*Account, error)

func (Account) Apps

func (a Account) Apps() ([]*App, error)

func (Account) CheckPassword

func (a Account) CheckPassword(pwd string) bool

func (*Account) CreateApp

func (a *Account) CreateApp(name string) (*App, error)

func (*Account) CreateSession

func (a *Account) CreateSession(loginType int64, expire time.Duration) (string, error)

func (*Account) DeleteAppByID

func (a *Account) DeleteAppByID(id int64) error

func (*Account) DeleteSession

func (a *Account) DeleteSession() error

func (*Account) RetrieveAppByID

func (a *Account) RetrieveAppByID(id int64) (*App, error)

func (*Account) UpdatePassword

func (a *Account) UpdatePassword(pwd string) error

func (*Account) UpdateProfile

func (a *Account) UpdateProfile(opt *option) error

type App

type App struct {
	ID        int64  `json:"id"`
	Name      string `json:"name"`
	SecretKey string `json:"secretKey"`
	Status    int64  `json:"desc"`
	AccountID int64  `json:"accountId"`
	// contains filtered or unexported fields
}

func AppBySecretKey

func AppBySecretKey(secretKey string) (*App, error)

func (App) Account

func (app App) Account() (*Account, error)

type SetOption

type SetOption func(option *option) error

func SetAvatar

func SetAvatar(avatar string) SetOption

func SetDescription

func SetDescription(description string) SetOption

func SetName

func SetName(name string) SetOption

type Token

type Token struct {
	AccountID int64     `json:"accountId"`
	LoginType int64     `json:"loginType"`
	Token     string    `json:"token"`
	ExpiredAt time.Time `json:"expiredAt"`
	// contains filtered or unexported fields
}

func RetrieveToken

func RetrieveToken(token string) (*Token, error)

func (Token) Account

func (t Token) Account() (*Account, error)

Jump to

Keyboard shortcuts

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