Documentation
¶
Index ¶
- Constants
- Variables
- func Bool(src bool) *bool
- func Int(src int) *int
- func RunCommand() (string, bool)
- func String(src string) *string
- func ValidateMatch(fl validator.FieldLevel) bool
- type ErrorCode
- type IDBConfig
- type IError
- type IFiberEx
- func (p *IFiberEx) DefaultErrorHandler() func(*fiber.Ctx, error) error
- func (p *IFiberEx) ExecuteTemplate(out io.Writer, src string, values interface{}) error
- func (p *IFiberEx) GetRedisJson(rs interface{}, key string) error
- func (p *IFiberEx) IpAddr() string
- func (p *IFiberEx) JobEnqueue(queue string, class string, args interface{}) error
- func (p *IFiberEx) JobEnqueueAt(queue string, class string, at time.Time, args interface{}) error
- func (p *IFiberEx) JobEnqueueIn(queue string, class string, in float64, args interface{}) error
- func (p *IFiberEx) JobRun(jobs ...IJob)
- func (p *IFiberEx) Mail(to []string, subject string, body string, values interface{}) error
- func (p *IFiberEx) MetaMiddleware() func(*fiber.Ctx) error
- func (p *IFiberEx) NewApp() *fiber.App
- func (p *IFiberEx) NewJob(jobs ...*IJob)
- func (p *IFiberEx) NewMeta(c *fiber.Ctx) *IMeta
- func (p *IFiberEx) RequestParser(c *fiber.Ctx, params interface{}) bool
- func (p *IFiberEx) Result(c *fiber.Ctx, code int, results ...interface{}) error
- func (p *IFiberEx) ResultError(c *fiber.Ctx, code int, err error, errors ...IError) error
- func (p *IFiberEx) SetRedisJson(key string, src interface{}, expire time.Duration) error
- func (p *IFiberEx) SimpleValidation(src interface{}, field string, tag string) []IError
- func (p *IFiberEx) Validation(src interface{}) []IError
- func (p *IFiberEx) ValidationParser(errors validator.ValidationErrors) []IError
- type IFiberExConfig
- type IFiberExTest
- func (p *IFiberExTest) Api(message string, request *ITestRequest, status int, asserts ...*ITestCase)
- func (p *IFiberExTest) DryJobs(names ...string)
- func (p *IFiberExTest) It(message string)
- func (p *IFiberExTest) Job(it string, before func(), job func(), asserts ...*ITestCase)
- func (p *IFiberExTest) Routes(routes func(*IFiberEx))
- func (p *IFiberExTest) Run(it string, tests func())
- type IJob
- type IMeta
- type IRequestPaging
- type IResponse
- type ITestCase
- type ITestMethod
- type ITestRequest
Constants ¶
View Source
const MailFormat string = `From: %s
To: %s
%s
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: base64
%s`
Variables ¶
View Source
var DB *gorm.DB
View Source
var ES *elasticsearch.Client
View Source
var GLog *glogger.Interface
View Source
var Log *zap.Logger
View Source
var Redis *redis.Client
View Source
var Validator *validator.Validate
Functions ¶
func RunCommand ¶
func ValidateMatch ¶
func ValidateMatch(fl validator.FieldLevel) bool
Types ¶
type IFiberEx ¶
type IFiberEx struct {
NodeId string
Config IFiberExConfig
App *fiber.App
Log *zap.Logger
DB *gorm.DB
Redis *redis.Client
ES *elasticsearch.Client
Validator *validator.Validate
}
var Ex *IFiberEx
func New ¶
func New(config IFiberExConfig) *IFiberEx
func (*IFiberEx) DefaultErrorHandler ¶
func (*IFiberEx) ExecuteTemplate ¶
func (*IFiberEx) GetRedisJson ¶
json型から変換して取得
func (*IFiberEx) JobEnqueue ¶
func (*IFiberEx) JobEnqueueAt ¶
func (*IFiberEx) JobEnqueueIn ¶
func (*IFiberEx) RequestParser ¶
func (*IFiberEx) ResultError ¶
func (*IFiberEx) SetRedisJson ¶
json型に変換して保存
func (*IFiberEx) SimpleValidation ¶
func (*IFiberEx) Validation ¶
func (*IFiberEx) ValidationParser ¶
func (p *IFiberEx) ValidationParser(errors validator.ValidationErrors) []IError
type IFiberExConfig ¶
type IFiberExConfig struct {
// 実行モード
DevMode *bool
TestMode *bool
// fiber初期化パラメータ
IconFile *string
IconUrl *string
CorsOrigin *string
CorsHeaders *string
CaseSensitive *bool
Concurrency *int
DisableKeepalive *bool
ErrorHandler func(*fiber.Ctx, error) error
AppName *string
BodyLimit *int
// ページング処理
PagePer *int
// データベース接続
UseDB bool
DBConfig *IDBConfig
// キャッシュサーバ接続
UseRedis bool
RedisOptions *redis.Options
// elasticsearch接続
UseES bool
ESConfig *elasticsearch.Config
// SMTP
SmtpUseMd5 bool
SmtpFrom string
SmtpAddr string
SmtpUser *string
SmtpPass *string
// Job
JobAddr string
JobDatabase int
JobPool int
JobProcess int
}
func (*IFiberExConfig) NewDB ¶
func (p *IFiberExConfig) NewDB() *gorm.DB
func (*IFiberExConfig) NewES ¶
func (p *IFiberExConfig) NewES() *elasticsearch.Client
func (*IFiberExConfig) NewRedis ¶
func (p *IFiberExConfig) NewRedis() *redis.Client
type IFiberExTest ¶
type IFiberExTest struct {
Ex *IFiberEx
App *fiber.App
Redis *miniredis.Miniredis
Tester *apitest.APITest
// contains filtered or unexported fields
}
func NewTest ¶
func NewTest(t *testing.T, config IFiberExConfig) *IFiberExTest
func (*IFiberExTest) Api ¶
func (p *IFiberExTest) Api(message string, request *ITestRequest, status int, asserts ...*ITestCase)
func (*IFiberExTest) DryJobs ¶
func (p *IFiberExTest) DryJobs(names ...string)
func (*IFiberExTest) It ¶
func (p *IFiberExTest) It(message string)
func (*IFiberExTest) Job ¶
func (p *IFiberExTest) Job(it string, before func(), job func(), asserts ...*ITestCase)
func (*IFiberExTest) Routes ¶
func (p *IFiberExTest) Routes(routes func(*IFiberEx))
func (*IFiberExTest) Run ¶
func (p *IFiberExTest) Run(it string, tests func())
type IJob ¶
type IRequestPaging ¶
type ITestCase ¶
type ITestCase struct {
Method ITestMethod // assertしたい内容
Want interface{} // 期待値
Path string // jsonpath `$.id`
Store func() interface{} // データの取得 pathが指定されていない場合に使用
}
type ITestMethod ¶
type ITestMethod int
const ( TestMethodEqual ITestMethod = iota TestMethodNotEqual TestMethodContains TestMethodPresent TestMethodNotPresent TestMethodMatches TestMethodLen TestMethodGreaterThan TestMethodLessThan )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.