Documentation ¶
Index ¶
- Constants
- Variables
- func Atoi(src string) int
- func Atoi64(src string) int64
- func Bool(src bool) *bool
- func BoolToUint(ok bool) uint
- func ConvertCamelCase(src string) string
- func ConvertPascalCase(src string) string
- func ConvertSnakeCase(src string) string
- func ConvertStruct(src interface{}, out interface{}) error
- func DeepCopy(src interface{}, out interface{}) error
- func GetJsonTag[T comparable](src T, field string) string
- func InitErrors(path string)
- func Int(src int) *int
- func Int64(src int64) *int64
- func Itoa(src int64) string
- func JsonPath(src *simplejson.Json, path string) (result interface{})
- func MapToValueArray(src map[string]interface{}) []interface{}
- func Match(reg, str string) bool
- func NewErrors(err error) error
- func Now() *time.Time
- func Recover(ex *IFiberEx)
- func RequestParser[T comparable](ex *IFiberEx, c *fiber.Ctx, params *T) bool
- func RunCommand() (string, []string, bool)
- func StackTrace() []string
- func String(src string) *string
- func StructPath(src interface{}, path string) (result interface{})
- func ToJson(src interface{}) string
- func ToPrettyJson(src interface{}) string
- func UuidBase64Decoding(src string) (string, error)
- func UuidBase64Encoding(src string) (string, error)
- func ValidateMatch(fl validator.FieldLevel) bool
- func ValidatePassword(fl validator.FieldLevel) bool
- type ErrorCode
- type Errors
- type FilterString
- type IDBConfig
- type IError
- type IFiberEx
- func (p *IFiberEx) ApiErrorLogFields(c *fiber.Ctx, err error, fields ...zapcore.Field) []zapcore.Field
- func (p *IFiberEx) ApiLogFields(c *fiber.Ctx, fields ...zapcore.Field) []zapcore.Field
- func (p *IFiberEx) CatchPreparedStatementsError(err error)
- func (p *IFiberEx) ClearPreparedStatements()
- 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) LogCaller() zapcore.Field
- func (p *IFiberEx) LogError(err error, fields ...zap.Field)
- func (p *IFiberEx) LogFatal(err error, fields ...zap.Field)
- func (p *IFiberEx) LogInfo(msg string, fields ...zap.Field)
- func (p *IFiberEx) LogTrace(err error, fields ...zap.Field) *zap.Logger
- func (p *IFiberEx) LogWarn(err error, fields ...zap.Field)
- 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) Printf(base string, args ...interface{})
- func (p *IFiberEx) Println(args ...interface{})
- func (p *IFiberEx) ReconnectDB()
- func (p *IFiberEx) RequestParser(c *fiber.Ctx, params interface{}) booldeprecated
- 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) SentryScope(fields []zap.Field) *sentry.Scope
- 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(src interface{}, errors validator.ValidationErrors) []IError
- type IFiberExConfig
- type IFiberExConfigOption
- type IFiberExTest
- func (p *IFiberExTest) Api(message string, request *ITestRequest, status int, asserts ...*ITestCase)
- func (p *IFiberExTest) DryJobs(names ...string)
- func (p *IFiberExTest) Exec(it string, exec func() interface{}, asserts ...*ITestCase)
- 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 JobAlive = false
View Source
var LocalFilePath = ""
View Source
var Log *zap.Logger
View Source
var Redis *redis.Client
View Source
var Sentry *sentry.Client
View Source
var Validator *validator.Validate
Functions ¶
func ConvertStruct ¶ added in v0.1.32
func ConvertStruct(src interface{}, out interface{}) error
jsonを使って異なる型に変換
func DeepCopy ¶ added in v0.1.32
func DeepCopy(src interface{}, out interface{}) error
jsonを使ってデータを複製
func GetJsonTag ¶ added in v0.1.16
func GetJsonTag[T comparable](src T, field string) string
func InitErrors ¶ added in v0.1.42
func InitErrors(path string)
func JsonPath ¶ added in v0.1.38
func JsonPath(src *simplejson.Json, path string) (result interface{})
simplejsonから指定のパスの値を取得
func MapToValueArray ¶ added in v0.1.32
func MapToValueArray(src map[string]interface{}) []interface{}
map型をarray型に変換
func RequestParser ¶ added in v0.1.16
func RequestParser[T comparable](ex *IFiberEx, c *fiber.Ctx, params *T) bool
func RunCommand ¶
func StackTrace ¶ added in v0.1.42
func StackTrace() []string
func StructPath ¶ added in v0.1.35
func StructPath(src interface{}, path string) (result interface{})
構造体から指定のパスの値を取得
func UuidBase64Decoding ¶ added in v0.1.32
base64にエンコードされたUUIDをUUID形式に変換
func UuidBase64Encoding ¶ added in v0.1.32
UUIDをbase64に変換
func ValidateMatch ¶
func ValidateMatch(fl validator.FieldLevel) bool
func ValidatePassword ¶ added in v0.1.33
func ValidatePassword(fl validator.FieldLevel) bool
Types ¶
type FilterString ¶ added in v0.1.32
type FilterString string
json化時に文字列をフィルタリングする
func FilterStrings ¶ added in v0.1.32
func FilterStrings(src string) FilterString
func (FilterString) MarshalJSON ¶ added in v0.1.32
func (p FilterString) MarshalJSON() ([]byte, error)
func (FilterString) String ¶ added in v0.1.32
func (p FilterString) String() string
func (*FilterString) UnmarshalJSON ¶ added in v0.1.32
func (p *FilterString) UnmarshalJSON(data []byte) error
type IFiberEx ¶
type IFiberEx struct { NodeId string Config IFiberExConfig App *fiber.App Log *zap.Logger DB *gorm.DB Redis *redis.Client ES *elasticsearch.Client Sentry *sentry.Client Validator *validator.Validate }
var Ex *IFiberEx
func New ¶
func New(config IFiberExConfig) *IFiberEx
func (*IFiberEx) ApiErrorLogFields ¶ added in v0.1.42
func (*IFiberEx) ApiLogFields ¶ added in v0.1.31
func (*IFiberEx) CatchPreparedStatementsError ¶ added in v0.1.26
func (*IFiberEx) ClearPreparedStatements ¶ added in v0.1.26
func (p *IFiberEx) ClearPreparedStatements()
func (*IFiberEx) DefaultErrorHandler ¶
func (*IFiberEx) ExecuteTemplate ¶
func (*IFiberEx) GetRedisJson ¶
json型から変換して取得
func (*IFiberEx) JobEnqueue ¶
func (*IFiberEx) JobEnqueueAt ¶
func (*IFiberEx) JobEnqueueIn ¶
func (*IFiberEx) MetaMiddleware ¶
func (*IFiberEx) ReconnectDB ¶ added in v0.1.26
func (p *IFiberEx) ReconnectDB()
func (*IFiberEx) RequestParser
deprecated
func (*IFiberEx) ResultError ¶
func (*IFiberEx) SentryScope ¶ added in v0.1.13
func (*IFiberEx) SetRedisJson ¶
json型に変換して保存
func (*IFiberEx) SimpleValidation ¶
func (*IFiberEx) Validation ¶
func (*IFiberEx) ValidationParser ¶
type IFiberExConfig ¶
type IFiberExConfig struct { // 実行モード DevMode *bool TestMode *bool // 内部パラメータ SecretToken string TokenExpireAt time.Duration // 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 // サービスホスト Host string // ページング処理 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 // Sentry SentryDsn *string SentryScope *sentry.Scope SentryEnv string // Option 任意のパラメータの格納 Options *IFiberExConfigOption }
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 IFiberExConfigOption ¶ added in v0.1.8
type IFiberExConfigOption struct {
// contains filtered or unexported fields
}
func NewIFiberExConfigOption ¶ added in v0.1.8
func NewIFiberExConfigOption(src map[string]interface{}) *IFiberExConfigOption
func (*IFiberExConfigOption) GetInt ¶ added in v0.1.8
func (p *IFiberExConfigOption) GetInt(key string) int
func (*IFiberExConfigOption) GetInt64 ¶ added in v0.1.8
func (p *IFiberExConfigOption) GetInt64(key string) int64
func (*IFiberExConfigOption) GetString ¶ added in v0.1.8
func (p *IFiberExConfigOption) GetString(key string) string
type IFiberExTest ¶
type IFiberExTest struct { Ex *IFiberEx App *fiber.App Redis *miniredis.Miniredis // 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) Exec ¶ added in v0.1.35
func (p *IFiberExTest) Exec(it string, exec func() interface{}, asserts ...*ITestCase)
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 IJob struct { Name string // ジョブ名 Proc func(msg *workers.Msg) // 処理内容 Concurrency int // 優先度 Schedule *string // cron形式 https://github.com/bamzi/jobrunner Class string // スケジュール実行時のクラス名 Args func() interface{} // スケジュール実行時のパラメータ Middlewares []workers.Action // ジョブ特有のアクション }
type IRequestPaging ¶
type ITestCase ¶
type ITestCase struct { It string // テストケースの説明 Method ITestMethod // assertしたい内容 Want interface{} // 期待値 Path string // jsonpath `$.id` Store func() interface{} // データの取得 pathが指定されていない場合に使用 Result func(result interface{}) interface{} // データの取得して加工する // contains filtered or unexported fields }
func (*ITestCase) ResultAssert ¶ added in v0.1.35
func (*ITestCase) StoreAssert ¶ added in v0.1.35
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.