rasant

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: MIT Imports: 44 Imported by: 0

README

Rasant

Rasant is a web application framework written in the Go language.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database added in v0.0.10

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

type Encryption added in v0.0.15

type Encryption struct {
	Key []byte
}

func (*Encryption) Decrypt added in v0.0.15

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

func (*Encryption) Encrypt added in v0.0.15

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

type Rasant

type Rasant 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
	FileSystems   map[string]interface{}
	// contains filtered or unexported fields
}

Rasant is the overall type for the Rasant package. Members that are exported in this type are available to any application that uses it.

func (*Rasant) BuildDSN added in v0.0.10

func (ras *Rasant) BuildDSN() string

func (*Rasant) CreateDirIfNotExist

func (ras *Rasant) CreateDirIfNotExist(path string) error

func (*Rasant) CreateFileIfNotExist

func (ras *Rasant) CreateFileIfNotExist(path string) error

func (*Rasant) DownloadFile added in v0.0.15

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

func (*Rasant) Error404 added in v0.0.15

func (ras *Rasant) Error404(w http.ResponseWriter, r *http.Request)

func (*Rasant) Error500 added in v0.0.15

func (ras *Rasant) Error500(w http.ResponseWriter, r *http.Request)

func (*Rasant) ErrorForbidden added in v0.0.15

func (ras *Rasant) ErrorForbidden(w http.ResponseWriter, r *http.Request)

func (*Rasant) ErrorStatus added in v0.0.15

func (ras *Rasant) ErrorStatus(w http.ResponseWriter, status int)

func (*Rasant) ErrorUnauthorized added in v0.0.15

func (ras *Rasant) ErrorUnauthorized(w http.ResponseWriter, r *http.Request)

func (*Rasant) Init

func (ras *Rasant) Init(p initPaths) error

Init creates necessary folders for our Rasant application

func (*Rasant) ListenAndServe

func (ras *Rasant) ListenAndServe()

ListenAndServe starts the web server

func (*Rasant) LoadTime added in v0.0.20

func (ras *Rasant) LoadTime(start time.Time)

func (*Rasant) MigrateDownAll added in v0.0.13

func (ras *Rasant) MigrateDownAll(dsn string) error

func (*Rasant) MigrateForce added in v0.0.13

func (ras *Rasant) MigrateForce(dsn string) error

func (*Rasant) MigrateUp added in v0.0.13

func (ras *Rasant) MigrateUp(dsn string) error

func (*Rasant) New

func (ras *Rasant) New(rootPath string) error

New reads the .env file, creates our application config, populates the Rasant type with settings based on .env values, and creates necessary folders and files if they don't exist

func (*Rasant) NoSurf added in v0.0.19

func (ras *Rasant) NoSurf(next http.Handler) http.Handler

func (*Rasant) OpenDB added in v0.0.10

func (res *Rasant) OpenDB(dbType, dsn string) (*sql.DB, error)

func (*Rasant) RandomString added in v0.0.11

func (ras *Rasant) RandomString(n int) string

RandomString generates a random string length n from values in the const randomString

func (*Rasant) ReadJSON added in v0.0.17

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

func (*Rasant) SessionLoad added in v0.0.7

func (ras *Rasant) SessionLoad(next http.Handler) http.Handler

func (*Rasant) Steps added in v0.0.13

func (ras *Rasant) Steps(n int, dsn string) error

func (*Rasant) Validator added in v0.0.15

func (ras *Rasant) Validator(data url.Values) *Validation

func (*Rasant) WriteJSON added in v0.0.13

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

func (*Rasant) WriteXML added in v0.0.15

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

type Server added in v0.0.28

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

type Validation added in v0.0.15

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

func (*Validation) AddError added in v0.0.15

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

func (*Validation) Check added in v0.0.15

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

func (*Validation) Has added in v0.0.15

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

func (*Validation) IsDateISO added in v0.0.15

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

func (*Validation) IsEmail added in v0.0.15

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

func (*Validation) IsFloat added in v0.0.15

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

func (*Validation) IsInt added in v0.0.15

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

func (*Validation) NoSpaces added in v0.0.15

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

func (*Validation) Required added in v0.0.15

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

func (*Validation) Valid added in v0.0.15

func (v *Validation) Valid() bool

Jump to

Keyboard shortcuts

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