Documentation ¶
Index ¶
- type AuthService
- type CacheService
- type Config
- type ConfigService
- type CookieService
- type DBLogger
- type DBService
- type Exception
- type ExceptionService
- type Handler
- type Handlers
- type IRouter
- type IRoutes
- type LoggerService
- type Passwd
- type PasswdService
- type Response
- type ResponseService
- type RouteService
- type Service
- type Storage
- type SymCryptService
- type TransAll
- type TransCategory
- type TransMap
- type TranslateService
- type UploadService
- type UtilService
- type ValidatorService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthService ¶
type CacheService ¶
type CacheService interface { Service SetDefault(k string, x any) Set(k string, x any, d time.Duration) Add(k string, x any, d time.Duration) error Replace(k string, x any, d time.Duration) error Increment(k string, n int64) error Decrement(k string, n int64) error Get(k string) (any, bool) GetWithExpiration(k string) (any, time.Time, bool) Flash(k string) (any, bool) Delete(k string) Flush() SaveFile(filename string) error LoadFile(filename string) error ItemCount() int }
type ConfigService ¶
ConfigService 配置服务接口
type CookieService ¶
type DBService ¶
type DBService interface { Service AutoMigrate(dst ...interface{}) error Association(column string) *gorm.Association Attrs(attrs ...interface{}) (tx *gorm.DB) Assign(attrs ...interface{}) (tx *gorm.DB) AddError(err error) error Begin(opts ...*sql.TxOptions) *gorm.DB Create(value interface{}) (tx *gorm.DB) CreateInBatches(value interface{}, batchSize int) (tx *gorm.DB) Count(count *int64) (tx *gorm.DB) Connection(fc func(tx *gorm.DB) error) (err error) Commit() *gorm.DB Clauses(conds ...clause.Expression) (tx *gorm.DB) Distinct(args ...interface{}) (tx *gorm.DB) Delete(value interface{}, conds ...interface{}) (tx *gorm.DB) Debug() (tx *gorm.DB) SqlDB() (*sql.DB, error) Exec(sql string, values ...interface{}) (tx *gorm.DB) First(dest interface{}, conds ...interface{}) (tx *gorm.DB) Find(dest interface{}, conds ...interface{}) (tx *gorm.DB) FindInBatches(dest interface{}, batchSize int, fc func(tx *gorm.DB, batch int) error) *gorm.DB FirstOrInit(dest interface{}, conds ...interface{}) (tx *gorm.DB) FirstOrCreate(dest interface{}, conds ...interface{}) (tx *gorm.DB) Group(name string) (tx *gorm.DB) Get(key string) (interface{}, bool) GormDB() *gorm.DB Having(query interface{}, args ...interface{}) (tx *gorm.DB) InnerJoins(query string, args ...interface{}) (tx *gorm.DB) InstanceSet(key string, value interface{}) *gorm.DB InstanceGet(key string) (interface{}, bool) Joins(query string, args ...interface{}) (tx *gorm.DB) Last(dest interface{}, conds ...interface{}) (tx *gorm.DB) Limit(limit int) (tx *gorm.DB) Migrator() gorm.Migrator Model(value interface{}) (tx *gorm.DB) Not(query interface{}, args ...interface{}) (tx *gorm.DB) Omit(columns ...string) (tx *gorm.DB) Or(query interface{}, args ...interface{}) (tx *gorm.DB) Order(value interface{}) (tx *gorm.DB) Offset(offset int) (tx *gorm.DB) Pluck(column string, dest interface{}) (tx *gorm.DB) Preload(query string, args ...interface{}) (tx *gorm.DB) Raw(sql string, values ...interface{}) (tx *gorm.DB) Row() *sql.Row Rows() (*sql.Rows, error) Rollback() *gorm.DB RollbackTo(name string) *gorm.DB Save(value interface{}) (tx *gorm.DB) Scan(dest interface{}) (tx *gorm.DB) ScanRows(rows *sql.Rows, dest interface{}) error SavePoint(name string) *gorm.DB Select(query interface{}, args ...interface{}) (tx *gorm.DB) Scopes(funcs ...func(*gorm.DB) *gorm.DB) (tx *gorm.DB) Session(config *gorm.Session) *gorm.DB Set(key string, value interface{}) *gorm.DB SetupJoinTable(model interface{}, field string, joinTable interface{}) error Table(name string, args ...interface{}) (tx *gorm.DB) Take(dest interface{}, conds ...interface{}) (tx *gorm.DB) Transaction(fc func(tx *gorm.DB) error, opts ...*sql.TxOptions) (err error) ToSQL(queryFn func(tx *gorm.DB) *gorm.DB) string Use(plugin gorm.Plugin) error Unscoped() (tx *gorm.DB) Update(column string, value interface{}) (tx *gorm.DB) Updates(values interface{}) (tx *gorm.DB) UpdateColumn(column string, value interface{}) (tx *gorm.DB) UpdateColumns(values interface{}) (tx *gorm.DB) WithContext(ctx context.Context) *gorm.DB Where(query interface{}, args ...interface{}) (tx *gorm.DB) }
type Exception ¶
type Exception interface { error Service Set(arg any) Exception Get(field string) (any, error) New(code int, args ...any) Exception Build(args ...any) Exception Handle(c *gin.Context) bool }
Exception 异常内容接口
type ExceptionService ¶
type ExceptionService interface { Service Build(args ...any) Exception Handle(c *gin.Context) bool }
ExceptionService 异常服务接口
type IRoutes ¶
type IRoutes interface { Use(...Handler) RouteService Handle(string, string, ...Handler) IRoutes Any(string, ...Handler) IRoutes GET(string, ...Handler) IRoutes POST(string, ...Handler) IRoutes DELETE(string, ...Handler) IRoutes PATCH(string, ...Handler) IRoutes PUT(string, ...Handler) IRoutes OPTIONS(string, ...Handler) IRoutes HEAD(string, ...Handler) IRoutes Match([]string, string, ...Handler) IRoutes Resource(string, any, ...Handler) IRoutes StaticFile(string, string) IRoutes StaticFileFS(string, string, http.FileSystem) IRoutes Static(string, string) IRoutes StaticFS(string, http.FileSystem) IRoutes }
IRoutes 定义所有路由器句柄接口.
type LoggerService ¶
type LoggerService interface { Service Check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry Core() zapcore.Core Debug(msg string, fields ...zap.Field) DPanic(msg string, fields ...zap.Field) Error(msg string, fields ...zap.Field) Fatal(msg string, fields ...zap.Field) Info(msg string, fields ...zap.Field) Level() zapcore.Level Log(lvl zapcore.Level, msg string, fields ...zap.Field) Named(s string) *zap.Logger Panic(msg string, fields ...zap.Field) Sugar() *zap.SugaredLogger Sync() error WithOptions(opts ...zap.Option) *zap.Logger With(fields ...zap.Field) *zap.Logger Warn(msg string, fields ...zap.Field) Zap() *zap.Logger DB() DBLogger }
LoggerService 日志服务
type PasswdService ¶
type Response ¶
type Response interface { Service Set(any) Response Get(field string) (any, error) New(code int, args ...any) Response Build(code int, args ...any) Response Handle(c *gin.Context) bool }
Response 响应体接口
type ResponseService ¶
type ResponseService interface { Service Build(code int, args ...any) Response Handle(c *gin.Context) bool IsToken(token string) bool }
ResponseService 响应体服务接口
type RouteService ¶
type RouteService interface { Service Handler() http.Handler SecureJsonPrefix(prefix string) RouteService Delims(left, right string) RouteService LoadHTMLGlob(pattern string) LoadHTMLGlobs(patterns ...string) error LoadHTMLFS(embed fs.FS, patterns ...string) LoadHTMLFiles(files ...string) SetHTMLTemplate(tmpl *template.Template) SetFuncMap(funcMap template.FuncMap) NoRoute(handlers ...Handler) NoMethod(handlers ...Handler) Routes() (routes gin.RoutesInfo) Run(addr ...string) (err error) RunTLS(addr, certFile, keyFile string) (err error) RunUnix(file string) (err error) RunFd(fd int) (err error) RunListener(listener net.Listener) (err error) HandleContext(c *gin.Context) Group(relativePath string, handlers ...Handler) IRouter UseBefore(middleware ...Handler) RouteService Use(middleware ...Handler) RouteService Handle(httpMethod, relativePath string, handlers ...Handler) IRoutes Any(relativePath string, handlers ...Handler) IRoutes GET(relativePath string, handlers ...Handler) IRoutes POST(relativePath string, handlers ...Handler) IRoutes DELETE(relativePath string, handlers ...Handler) IRoutes PATCH(relativePath string, handlers ...Handler) IRoutes PUT(relativePath string, handlers ...Handler) IRoutes OPTIONS(relativePath string, handlers ...Handler) IRoutes HEAD(relativePath string, handlers ...Handler) IRoutes Match(methods []string, relativePath string, handlers ...Handler) IRoutes Resource(resource string, controller any, handlers ...Handler) IRoutes StaticFile(relativePath, filepath string) IRoutes StaticFileFS(relativePath, filepath string, fs http.FileSystem) IRoutes Static(relativePath, root string) IRoutes StaticFS(relativePath string, fs http.FileSystem) IRoutes ServeHTTP(w http.ResponseWriter, req *http.Request) }
RouteService 路由服务接口
type SymCryptService ¶
type TransCategory ¶
type TranslateService ¶
type UploadService ¶
type UtilService ¶
type UtilService interface { Service Nanoid(args ...int) string Direct(v reflect.Value) reflect.Value SetEnv(env, key, value string) error SecretKey(length int) (string, error) ExcKey() string BlackTokenKey(nanoid string) string Ptr(v any) any CreateDir(dir string) string IsExist(file string) bool SHA256(str string) string }
type ValidatorService ¶
type ValidatorService interface { Service Translate(errs validator.ValidationErrors) validator.ValidationErrorsTranslations GetTrans() ut.Translator }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.