common

package
v0.1.4-beta.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAuthenticationExpired = errors.NewPublic("认证过期,请重新登录")
View Source
var ErrCodeFrequently = errors.NewPublic("您的验证码请求频繁,请稍后再试")
View Source
var ErrEmailInvalid = errors.NewPublic("邮箱验证码无效")
View Source
var ErrEmailNotExists = errors.NewPublic("该账户不存在或被冻结")
View Source
var ErrLoginInvalid = errors.NewPublic("登录验证无效")
View Source
var ErrLoginMaxFailures = errors.NewPublic("登录失败超出最大次数")
View Source
var ErrLoginNotExists = errors.NewPublic("登录账号不存在或被冻结")
View Source
var ErrSession = errors.NewPrivate("会话建立失败")
View Source
var ErrSessionInconsistent = errors.NewPublic("会话令牌不一致")
View Source
var ErrSmsInvalid = errors.NewPublic("短信验证码无效")
View Source
var ErrSmsNotExists = errors.NewPublic("该账户不存在或被冻结")
View Source
var ErrTotpInvalid = errors.NewPublic("口令验证码无效")

Functions

func Claims added in v0.1.0

func Claims(c *app.RequestContext) (claims passport.Claims)

func ClearAccessToken added in v0.1.0

func ClearAccessToken(c *app.RequestContext)

func SetAccessToken added in v0.1.0

func SetAccessToken(c *app.RequestContext, ts string)

Types

type Extra added in v0.1.0

type Extra struct {
	BaseUrl               string `yaml:"base_url"`
	IpAddress             string `yaml:"ip_address"`
	IpSecretId            string `yaml:"ip_secret_id"`
	IpSecretKey           string `yaml:"ip_secret_key"`
	SmsSecretId           string `yaml:"sms_secret_id"`
	SmsSecretKey          string `yaml:"sms_secret_key" secret:"*"`
	SmsAppId              string `yaml:"sms_app_id"`
	SmsRegion             string `yaml:"sms_region"`
	EmqxHost              string `yaml:"emqx_host"`
	EmqxApiKey            string `yaml:"emqx_api_key"`
	EmqxSecretKey         string `yaml:"emqx_secret_key" secret:"*"`
	*values.DynamicValues `yaml:"dynamic_values"`
}

type Inject added in v0.0.28

type Inject struct {
	V         *Values
	Mgo       *mongo.Client
	Db        *mongo.Database
	RDb       *redis.Client
	Flux      influxdb2.Client
	JetStream nats.JetStreamContext
	KeyValue  nats.KeyValue
	Cipher    *cipher.Cipher
	Passport  *passport.Passport
	Captcha   *captcha.Captcha
	Locker    *locker.Locker
	Workflow  *workflow.Workflow
}

type Values

type Values struct {
	Mode      string `env:"MODE" envDefault:"debug"`
	Address   string `env:"ADDRESS" envDefault:":3000"`
	Namespace string `env:"NAMESPACE,required"`
	Key       string `env:"KEY,required"`

	Database struct {
		Url   string `env:"URL,required"`
		Name  string `env:"NAME,required"`
		Redis string `env:"REDIS,required"`
	} `envPrefix:"DATABASE_"`

	Influx struct {
		Url    string `env:"URL"`
		Org    string `env:"ORG"`
		Token  string `env:"TOKEN"`
		Bucket string `env:"BUCKET"`
	} `envPrefix:"INFLUX_"`

	Nats struct {
		Hosts []string `env:"HOSTS,required" envSeparator:","`
		Nkey  string   `env:"NKEY,required"`
	} `envPrefix:"NATS_"`

	Otlp struct {
		Endpoint string `env:"ENDPOINT"`
	} `envPrefix:"OTLP_"`

	*Extra
}

func (Values) IsRelease added in v0.1.0

func (x Values) IsRelease() bool

func (Values) Name added in v0.0.29

func (x Values) Name(v ...string) string

func (Values) NameX added in v0.1.0

func (x Values) NameX(sep string, v ...string) string

Jump to

Keyboard shortcuts

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