celeritas

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2022 License: MIT Imports: 41 Imported by: 0

README

celeritas

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Celeritas

type Celeritas struct {
	AppName  string
	Debug    bool
	Version  string
	ErrorLog *log.Logger
	InfoLog  *log.Logger
	RootPath string
	Routes   *chi.Mux
	Render   *render.Render
	Session  *scs.SessionManager
	DB       Database
	JetViews jet.Set

	EncryptionKey string
	Cache         cache.Cache
	Scheduler     *cron.Cron
	Mail          mailer.Mail
	Server        Server
	// contains filtered or unexported fields
}

func (*Celeritas) BuildDSN

func (c *Celeritas) BuildDSN() string

func (*Celeritas) CreateDirIfNotExist

func (c *Celeritas) CreateDirIfNotExist(path string) error

func (*Celeritas) CreateFileIfNotExist

func (c *Celeritas) CreateFileIfNotExist(path string) error

func (*Celeritas) DownloadFile

func (c *Celeritas) DownloadFile(w http.ResponseWriter, r *http.Request, pathToFile, fileName string) error

func (*Celeritas) Error404

func (c *Celeritas) Error404(w http.ResponseWriter, r *http.Request)

func (*Celeritas) Error500

func (c *Celeritas) Error500(w http.ResponseWriter, r *http.Request)

func (*Celeritas) ErrorForbidden

func (c *Celeritas) ErrorForbidden(w http.ResponseWriter, r *http.Request)

func (*Celeritas) ErrorStatus

func (c *Celeritas) ErrorStatus(w http.ResponseWriter, status int)

func (*Celeritas) ErrorUnauthorized

func (c *Celeritas) ErrorUnauthorized(w http.ResponseWriter, r *http.Request)

func (*Celeritas) Init

func (c *Celeritas) Init(p initPaths) error

func (*Celeritas) ListenAndServe

func (c *Celeritas) ListenAndServe()

Starts the Standard Webserver

func (*Celeritas) MigrateDownAll

func (c *Celeritas) MigrateDownAll(dsn string) error

func (*Celeritas) MigrateForce

func (c *Celeritas) MigrateForce(dsn string) error

func (*Celeritas) MigrateSteps

func (c *Celeritas) MigrateSteps(n int, dsn string) error

func (*Celeritas) MigrateUp

func (c *Celeritas) MigrateUp(dsn string) error

func (*Celeritas) New

func (c *Celeritas) New(rootPath string) error

func (*Celeritas) NoSurf

func (c *Celeritas) NoSurf(next http.Handler) http.Handler

func (*Celeritas) OpenDB

func (c *Celeritas) OpenDB(dbType, dsn string) (*sql.DB, error)

func (*Celeritas) RandomString

func (c *Celeritas) RandomString(n int) string

Generate a Random String

func (*Celeritas) ReadJSON

func (c *Celeritas) ReadJSON(w http.ResponseWriter, r *http.Request, data interface{}) error

func (*Celeritas) SessionLoad

func (c *Celeritas) SessionLoad(next http.Handler) http.Handler

func (*Celeritas) Validator

func (c *Celeritas) Validator(data url.Values) *Validation

func (*Celeritas) WriteJSON

func (c *Celeritas) WriteJSON(w http.ResponseWriter, status int, data interface{}, headers ...http.Header) error

func (*Celeritas) WriteXML

func (c *Celeritas) WriteXML(w http.ResponseWriter, status int, data interface{}, headers ...http.Header) error

type Database

type Database struct {
	DatabaseType string
	Pool         *sql.DB
}

type Encryption

type Encryption struct {
	Key []byte
}

func (*Encryption) Decrypt

func (e *Encryption) Decrypt(cryptoText string) (string, error)

func (*Encryption) Encrypt

func (e *Encryption) Encrypt(text string) (string, error)

type Server

type Server struct {
	ServerName string
	Port       string
	Secure     bool
	URL        string
}

type Validation

type Validation struct {
	Data   url.Values
	Errors map[string]string
}

func (*Validation) AddError

func (v *Validation) AddError(key, message string)

func (*Validation) Check

func (v *Validation) Check(ok bool, key, message string)

func (*Validation) Has

func (v *Validation) Has(field string, r *http.Request) bool

func (*Validation) IsDateISO

func (v *Validation) IsDateISO(field, value string)

func (*Validation) IsEMail

func (v *Validation) IsEMail(field, value string)

func (*Validation) IsFloat

func (v *Validation) IsFloat(field, value string)

func (*Validation) IsInt

func (v *Validation) IsInt(field, value string)

func (*Validation) NoSpaces

func (v *Validation) NoSpaces(field, value string)

func (*Validation) Required

func (v *Validation) Required(r *http.Request, fields ...string)

func (*Validation) Valid

func (v *Validation) Valid() bool

Directories

Path Synopsis
cmd
cli

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL