Documentation ¶
Index ¶
- Constants
- func DisableEvents()
- func EnableEvents()
- func NewGorm() *gorm.DB
- func ResolveGorm() *gorm.DB
- func UseMiddleware(mw Middleware)
- type App
- func (app *App) Bootstrap()
- func (app *App) MakeDirs(dirs ...string)
- func (app *App) Next(c *Context)
- func (app *App) RegisterRoutes(routes []Route, router *httprouter.Router) *httprouter.Router
- func (app *App) Run(router *httprouter.Router)
- func (app *App) SetBasePath(path string)
- func (app *App) SetCacheConfig(c CacheConfig)
- func (app *App) SetGormConfig(g GormConfig)
- func (app *App) SetLogsDriver(d logger.LogsDriver)
- func (app *App) SetRequestConfig(r RequestConfig)
- type Cache
- type CacheConfig
- type Context
- func (c *Context) CastToFloat(value interface{}) float64
- func (c *Context) CastToInt(value interface{}) int
- func (c *Context) CastToString(value interface{}) string
- func (c *Context) CopyFile(sourceFilePath string, destFolderPath string) error
- func (c *Context) DebugAny(variable interface{})
- func (c *Context) GetBaseDirPath() string
- func (c *Context) GetHeader(key string) string
- func (c *Context) GetPathParam(key string) interface{}
- func (c *Context) GetRequestParam(key string) interface{}
- func (c *Context) GetUploadedFile(name string) *UploadedFileInfo
- func (c Context) GetUserAgent() string
- func (c *Context) MapToJson(v any) string
- func (c *Context) MoveFile(sourceFilePath string, destFolderPath string) error
- func (c *Context) Next()
- func (c *Context) RequestParamExists(key string) bool
- type EmailAddress
- type EmailAttachment
- type EnvFileConfig
- type Event
- type EventJob
- type EventsManager
- type GormConfig
- type Handler
- type Hashing
- type JWT
- type JWTConfig
- type JWTOptions
- type Mailer
- func (m *Mailer) Send() error
- func (m *Mailer) SetAttachments(attachments []EmailAttachment) *Mailer
- func (m *Mailer) SetBCC(emailAddresses []EmailAddress) *Mailer
- func (m *Mailer) SetCC(emailAddresses []EmailAddress) *Mailer
- func (m *Mailer) SetFrom(emailAddresses EmailAddress) *Mailer
- func (m *Mailer) SetHTMLBody(body string) *Mailer
- func (m *Mailer) SetPlainTextBody(body string) *Mailer
- func (m *Mailer) SetSubject(subject string) *Mailer
- func (m *Mailer) SetTo(emailAddresses []EmailAddress) *Mailer
- type Middleware
- type Middlewares
- type Request
- type RequestConfig
- type Response
- func (rs *Response) Any(body any) *Response
- func (rs *Response) ForceSendResponse()
- func (rs *Response) HTML(body string) *Response
- func (rs *Response) Json(body string) *Response
- func (rs *Response) Redirect(url string) *Response
- func (rs *Response) SetContentType(c string) *Response
- func (rs *Response) SetHeader(key string, val string) *Response
- func (rs *Response) SetStatusCode(code int) *Response
- func (rs *Response) Text(body string) *Response
- type Route
- type Router
- func (r *Router) Delete(path string, handler Handler, middlewares ...Middleware) *Router
- func (r *Router) Get(path string, handler Handler, middlewares ...Middleware) *Router
- func (r *Router) GetRoutes() []Route
- func (r *Router) Head(path string, handler Handler, middlewares ...Middleware) *Router
- func (r *Router) Options(path string, handler Handler, middlewares ...Middleware) *Router
- func (r *Router) Patch(path string, handler Handler, middlewares ...Middleware) *Router
- func (r *Router) Post(path string, handler Handler, middlewares ...Middleware) *Router
- func (r *Router) Put(path string, handler Handler, middlewares ...Middleware) *Router
- type UploadedFileInfo
- type Validator
Constants ¶
View Source
const CONTENT_TYPE string = "content-Type"
View Source
const CONTENT_TYPE_HTML string = "text/html; charset=utf-8"
View Source
const CONTENT_TYPE_JSON string = "application/json"
View Source
const CONTENT_TYPE_MULTIPART_FORM_DATA string = "multipart/form-data;"
View Source
const CONTENT_TYPE_TEXT string = "text/plain"
View Source
const DELETE string = "delete"
View Source
const GET string = "get"
View Source
const HEAD string = "head"
View Source
const LOCALHOST string = "http://localhost"
View Source
const OPTIONS string = "options"
View Source
const PATCH string = "patch"
View Source
const POST string = "post"
View Source
const PRODUCTION string = "production"
View Source
const PUT string = "put"
View Source
const TEST_STR string = "Testing!"
Variables ¶
This section is empty.
Functions ¶
func DisableEvents ¶ added in v1.7.1
func DisableEvents()
func EnableEvents ¶ added in v1.7.1
func EnableEvents()
func ResolveGorm ¶ added in v1.5.0
func UseMiddleware ¶ added in v1.5.0
func UseMiddleware(mw Middleware)
Types ¶
type App ¶
type App struct { Config *configContainer // contains filtered or unexported fields }
func ResolveApp ¶ added in v1.5.0
func ResolveApp() *App
func (*App) RegisterRoutes ¶
func (app *App) RegisterRoutes(routes []Route, router *httprouter.Router) *httprouter.Router
func (*App) Run ¶
func (app *App) Run(router *httprouter.Router)
func (*App) SetBasePath ¶ added in v1.7.1
func (*App) SetCacheConfig ¶ added in v1.5.0
func (app *App) SetCacheConfig(c CacheConfig)
func (*App) SetGormConfig ¶ added in v1.5.0
func (app *App) SetGormConfig(g GormConfig)
func (*App) SetLogsDriver ¶ added in v1.5.0
func (app *App) SetLogsDriver(d logger.LogsDriver)
func (*App) SetRequestConfig ¶ added in v1.5.0
func (app *App) SetRequestConfig(r RequestConfig)
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func NewCache ¶ added in v1.5.0
func NewCache(cacheConfig CacheConfig) *Cache
type CacheConfig ¶ added in v1.5.0
type CacheConfig struct {
EnableCache bool
}
type Context ¶ added in v1.5.0
type Context struct { Request *Request Response *Response GetValidator func() *Validator GetJWT func() *JWT GetGorm func() *gorm.DB GetCache func() *Cache GetHashing func() *Hashing GetMailer func() *Mailer GetEventsManager func() *EventsManager GetLogger func() *logger.Logger }
func (*Context) CastToFloat ¶ added in v1.5.0
func (*Context) CastToString ¶ added in v1.5.0
func (*Context) DebugAny ¶ added in v1.5.0
func (c *Context) DebugAny(variable interface{})
TODO enhance
func (*Context) GetBaseDirPath ¶ added in v1.5.0
func (*Context) GetPathParam ¶ added in v1.5.0
func (*Context) GetRequestParam ¶ added in v1.5.0
func (*Context) GetUploadedFile ¶ added in v1.5.0
func (c *Context) GetUploadedFile(name string) *UploadedFileInfo
func (Context) GetUserAgent ¶ added in v1.7.1
func (*Context) RequestParamExists ¶ added in v1.5.0
type EmailAddress ¶ added in v1.6.0
type EmailAttachment ¶ added in v1.6.0
type EnvFileConfig ¶ added in v1.5.0
type EnvFileConfig struct {
UseDotEnvFile bool
}
type EventsManager ¶ added in v1.7.0
type EventsManager struct {
// contains filtered or unexported fields
}
func NewEventsManager ¶ added in v1.7.0
func NewEventsManager() *EventsManager
func ResolveEventsManager ¶ added in v1.7.0
func ResolveEventsManager() *EventsManager
func (*EventsManager) Fire ¶ added in v1.7.0
func (m *EventsManager) Fire(e *Event) error
func (*EventsManager) Register ¶ added in v1.7.0
func (m *EventsManager) Register(eName string, job EventJob)
type GormConfig ¶ added in v1.5.0
type GormConfig struct {
EnableGorm bool
}
type Hashing ¶ added in v1.6.0
type Hashing struct{}
func (*Hashing) CheckPasswordHash ¶ added in v1.6.0
type JWT ¶ added in v1.5.0
type JWT struct {
// contains filtered or unexported fields
}
func (*JWT) DecodeToken ¶ added in v1.5.0
func (*JWT) GenerateToken ¶ added in v1.5.0
type JWTOptions ¶ added in v1.5.0
type Mailer ¶ added in v1.6.0
type Mailer struct {
// contains filtered or unexported fields
}
func (*Mailer) SetAttachments ¶ added in v1.6.0
func (m *Mailer) SetAttachments(attachments []EmailAttachment) *Mailer
func (*Mailer) SetBCC ¶ added in v1.6.0
func (m *Mailer) SetBCC(emailAddresses []EmailAddress) *Mailer
func (*Mailer) SetCC ¶ added in v1.6.0
func (m *Mailer) SetCC(emailAddresses []EmailAddress) *Mailer
func (*Mailer) SetFrom ¶ added in v1.6.0
func (m *Mailer) SetFrom(emailAddresses EmailAddress) *Mailer
func (*Mailer) SetHTMLBody ¶ added in v1.6.0
func (*Mailer) SetPlainTextBody ¶ added in v1.6.0
func (*Mailer) SetSubject ¶ added in v1.6.0
func (*Mailer) SetTo ¶ added in v1.6.0
func (m *Mailer) SetTo(emailAddresses []EmailAddress) *Mailer
type Middleware ¶ added in v1.6.0
type Middleware func(c *Context)
type Middlewares ¶ added in v1.5.0
type Middlewares struct {
// contains filtered or unexported fields
}
func NewMiddlewares ¶ added in v1.5.0
func NewMiddlewares() *Middlewares
func ResolveMiddlewares ¶ added in v1.5.0
func ResolveMiddlewares() *Middlewares
func (*Middlewares) Attach ¶ added in v1.5.0
func (m *Middlewares) Attach(mw Middleware) *Middlewares
func (*Middlewares) GetMiddlewares ¶ added in v1.5.0
func (m *Middlewares) GetMiddlewares() []Middleware
type RequestConfig ¶ added in v1.5.0
type RequestConfig struct {
MaxUploadFileSize int
}
type Response ¶ added in v1.5.0
type Response struct { HttpResponseWriter http.ResponseWriter // contains filtered or unexported fields }
func (*Response) ForceSendResponse ¶ added in v1.6.0
func (rs *Response) ForceSendResponse()
func (*Response) SetContentType ¶ added in v1.6.0
TODO add doc
func (*Response) SetStatusCode ¶ added in v1.6.0
TODO add doc
type Route ¶ added in v1.5.0
type Route struct { Method string Path string Handler Handler Middlewares []Middleware }
type Router ¶ added in v1.5.0
type Router struct {
Routes []Route
}
func ResolveRouter ¶ added in v1.5.0
func ResolveRouter() *Router
func (*Router) Delete ¶ added in v1.5.0
func (r *Router) Delete(path string, handler Handler, middlewares ...Middleware) *Router
func (*Router) Get ¶ added in v1.5.0
func (r *Router) Get(path string, handler Handler, middlewares ...Middleware) *Router
func (*Router) Head ¶ added in v1.5.0
func (r *Router) Head(path string, handler Handler, middlewares ...Middleware) *Router
func (*Router) Options ¶ added in v1.5.0
func (r *Router) Options(path string, handler Handler, middlewares ...Middleware) *Router
func (*Router) Patch ¶ added in v1.5.0
func (r *Router) Patch(path string, handler Handler, middlewares ...Middleware) *Router
type UploadedFileInfo ¶ added in v1.5.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.