Documentation
      ¶
    
    
  
    
  
    Index ¶
- func Argon2Hash(password string) (string, error)
 - func Argon2Verify(password, encodedHash string) (bool, error)
 - func Bcrypt(password string, optionalCost ...int) string
 - func Blake2b(data string) string
 - func Blake2s(data string) string
 - func CompareBcrypt(password, hashed string) bool
 - func CreateLogFile(fileName string) error
 - func FakeData(filename string, count int)
 - func Info()
 - func LogError(function string, message string)
 - func Md5(args ...string) string
 - func Sha256(args ...string) string
 - func Sha3_256(args ...string) string
 - func Sha3_512(args ...string) string
 - func Sha512(args ...string) string
 - func Version()
 - type Context
 - func (c *Context) Default404()
 - func (c *Context) Default405()
 - func (c *Context) Delete() bool
 - func (c *Context) File(filepath string)
 - func (c *Context) FormArgon2(key string) string
 - func (c *Context) FormBcrypt(key string) string
 - func (c *Context) FormData(key string) string
 - func (c *Context) FormFile(key string) (multipart.File, *multipart.FileHeader, error)
 - func (c *Context) FormInt(key string) int
 - func (c *Context) FormMD5(key string) string
 - func (c *Context) FormSHA256(key string) string
 - func (c *Context) FormSHA512(key string) string
 - func (c *Context) Get() bool
 - func (c *Context) HTML(status int, tmplPath string, data interface{})
 - func (c *Context) JSON(status int, data interface{})
 - func (c *Context) JSONFile(status int, filepath string)
 - func (c *Context) JSONPretty(status int, data interface{}, indent ...int)
 - func (c *Context) Post() bool
 - func (c *Context) Put() bool
 - func (c *Context) Query(key string) string
 - func (c *Context) QueryBool(key string, defaultVal bool) bool
 - func (c *Context) QueryFloat(key string, defaultVal float64) float64
 - func (c *Context) QueryInt(key string) (int, error)
 - func (c *Context) QueryIntDefault(key string, defaulVal int) int
 - func (c *Context) Redirect(status int, url string)
 - func (c *Context) String(status int, text string)
 - func (c *Context) Stringf(status int, text string, a ...any)
 - func (c *Context) Template404(templatePath string, data ...any)
 - func (c *Context) Template405(templatePath string, data ...any)
 - func (c *Context) UserAgent() string
 
- type FakeUser
 - type HandlerFunc
 - type Router
 - type Server
 - func (s *Server) Delete(path string, handler HandlerFunc)
 - func (s *Server) Get(path string, handler HandlerFunc)
 - func (s *Server) Handle(path string, handler HandlerFunc)
 - func (s *Server) Post(path string, handler HandlerFunc)
 - func (s *Server) Put(path string, handler HandlerFunc)
 - func (s *Server) Run(addr ...string) error
 - func (s *Server) SetNotFound(handler HandlerFunc)
 - func (s *Server) Static(routePath, dir string)
 
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Argon2Hash ¶
func Argon2Verify ¶
func CompareBcrypt ¶
func CreateLogFile ¶
Types ¶
type Context ¶
type Context struct {
	Writer  http.ResponseWriter
	Request *http.Request
}
    func (*Context) Default404 ¶
func (c *Context) Default404()
func (*Context) Default405 ¶ added in v1.2.0
func (c *Context) Default405()
func (*Context) FormArgon2 ¶ added in v1.2.0
It automatically hashes the data received from the form with Argon2.
func (*Context) FormBcrypt ¶
Automatically hashes the data received from the form with Bcrypt
func (*Context) FormData ¶
FormData returns the value of a form field for the given key. It reads the data from POST or PUT form submissions.
func (*Context) FormFile ¶
FormFile retrieves the uploaded file and its header from a multipart form for the given form key. It returns the file, its header, and an error if the file cannot be found or opened
func (*Context) FormInt ¶
FormInt returns the value of a form field as an integer for the given key. If the conversion fails, it logs the error and returns 0.
func (*Context) FormSHA256 ¶
Hashes the data received from the form with Sha256 and returns it.
func (*Context) FormSHA512 ¶
Hashes the data received from the form with Sha512 and returns it.
func (*Context) JSON ¶
JSON encodes the given data as JSON and writes it to the response with the specified HTTP status code.
func (*Context) JSONFile ¶ added in v1.3.1
JSONFile serves a JSON file from the given file path with the specified HTTP status code. Returns 404 if the file is not found.
func (*Context) JSONPretty ¶ added in v1.3.1
JSONPretty encodes the given data as pretty-printed JSON and writes it to the response with the specified HTTP status code. Optional indent size can be provided.
func (*Context) QueryFloat ¶ added in v1.1.0
func (*Context) QueryIntDefault ¶ added in v1.1.0
func (*Context) Redirect ¶
Redirect sends an HTTP redirect to the specified URL with the given status code. Commonly used status codes are 302 (Found), 301 (Moved Permanently), and 307/308.
func (*Context) String ¶
String writes a plain string to the response with the specified HTTP status code.
func (*Context) Stringf ¶ added in v1.1.0
Stringf writes a formatted string to the response with the specified HTTP status code.
func (*Context) Template404 ¶
func (*Context) Template405 ¶ added in v1.2.0
type HandlerFunc ¶
type HandlerFunc func(ctx *Context)
type Router ¶
type Router struct {
	// contains filtered or unexported fields
}
    func (*Router) Handle ¶
func (r *Router) Handle(method, path string, handler HandlerFunc)
Tüm methodlar için
      
      Directories
      ¶
    
    | Path | Synopsis | 
|---|---|
| 
       examples
        | 
      |
| 
         
          
            basic
            
            command
          
          
         
       | 
      |
| 
         
          
            basic/useragent
            
            command
          
          
         
       | 
      |
| 
         
          
            register_app
            
            command
          
          
         
       | 
      |
| 
         
          
            search
            
            command
          
          
         
       | 
      |
| 
         
          
            simple_restapi
            
            command
          
          
         
       | 
      |
| 
         
          
            simple_restapi/users
            
            command
          
          
         
       | 
      |
| 
       test
        | 
      |
| 
         
          
            run_test
            
            command
          
          
         
       |