Documentation ¶
Index ¶
- type Database
- type Encryption
- type MicroGo
- func (m *MicroGo) BuildDataSourceName() string
- func (m *MicroGo) CreateDirIfNotExist(path string) error
- func (m *MicroGo) CreateFileIfNotExists(path string) error
- func (m *MicroGo) CreateRandomString(n int) string
- func (m *MicroGo) Error404(w http.ResponseWriter, r *http.Request)
- func (m *MicroGo) Error500(w http.ResponseWriter, r *http.Request)
- func (m *MicroGo) ErrorForbidden(w http.ResponseWriter, r *http.Request)
- func (m *MicroGo) ErrorStatus(w http.ResponseWriter, status int)
- func (m *MicroGo) ErrorUnauthorized(w http.ResponseWriter, r *http.Request)
- func (m *MicroGo) ErrorUnprocessable(w http.ResponseWriter, r *http.Request)
- func (m *MicroGo) Init(p initPaths) error
- func (m *MicroGo) ListenAndServe()
- func (m *MicroGo) LoadSessions(next http.Handler) http.Handler
- func (m *MicroGo) LoadTime(start time.Time)
- func (m *MicroGo) MigrateDownAll(dsn string) error
- func (m *MicroGo) MigrateForce(dsn string) error
- func (m *MicroGo) MigrateUp(dsn string) error
- func (m *MicroGo) New(rootPath string) error
- func (m *MicroGo) NoSurf(next http.Handler) http.Handler
- func (m *MicroGo) OpenDB(driverName, dataSourceName string) (*sql.DB, error)
- func (m *MicroGo) ReadJson(w http.ResponseWriter, r *http.Request, data interface{}) error
- func (m *MicroGo) SentFile(w http.ResponseWriter, r *http.Request, fileLocation, fileName string) error
- func (m *MicroGo) Steps(n int, dsn string) error
- func (m *MicroGo) Validator(data url.Values) *Validation
- func (m *MicroGo) WriteJson(w http.ResponseWriter, status int, data interface{}, headers ...http.Header) error
- func (m *MicroGo) WriteXML(w http.ResponseWriter, status int, data interface{}, headers ...http.Header) error
- type Server
- type Validation
- func (v *Validation) AddError(key, message string)
- func (v *Validation) Check(ok bool, key, message string)
- func (v *Validation) Has(field string, r *http.Request) bool
- func (v *Validation) IsDateISO(field, value string)
- func (v *Validation) IsEmail(field, value string)
- func (v *Validation) IsFloat(field, value string)
- func (v *Validation) IsInt(field, value string)
- func (v *Validation) NoSpaces(field, value string)
- func (v *Validation) Required(r *http.Request, fields ...string)
- func (v *Validation) Valid() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Encryption ¶
type Encryption struct {
Key []byte
}
type MicroGo ¶
type MicroGo struct { AppName string Debug bool Version string ErrorLog *log.Logger InfoLog *log.Logger WarningLog *log.Logger BuildLog *log.Logger RootPath string Routes *chi.Mux Render *render.Render JetView *jet.Set BlocksView *blocks.Blocks Session *scs.SessionManager DB Database EncryptionKey string Cache cache.Cache Scheduler *cron.Cron Mailer mailer.Mailer Server Server Requests *requests.Requests // contains filtered or unexported fields }
MicroGo is the overall type for the MicroGo package. Members that are exported in this type are available to any application that uses it.
func (*MicroGo) BuildDataSourceName ¶
BuildDataSourceName builds the datasource name for our database, and returns it as a string
func (*MicroGo) CreateDirIfNotExist ¶
CreateDirIfNotExist creates the necessary folder if not exist.
func (*MicroGo) CreateFileIfNotExists ¶
CreateFileIfNotExists creates the necessary files if not exist.
func (*MicroGo) CreateRandomString ¶
CreateRandomString A Random String Generator function based on n value length. From the values in the rndString const
func (*MicroGo) Error404 ¶
func (m *MicroGo) Error404(w http.ResponseWriter, r *http.Request)
Error404 : Return Not Found HTTP response .
Status Code : 404
func (*MicroGo) Error500 ¶
func (m *MicroGo) Error500(w http.ResponseWriter, r *http.Request)
Error500 : Return StatusInternal Server Error HTTP response .
Status Code : 500
func (*MicroGo) ErrorForbidden ¶
func (m *MicroGo) ErrorForbidden(w http.ResponseWriter, r *http.Request)
ErrorForbidden : Return StatusForbidden HTTP response.
Status Code : 403
func (*MicroGo) ErrorStatus ¶
func (m *MicroGo) ErrorStatus(w http.ResponseWriter, status int)
ErrorStatus : Construct Error HTTP response
func (*MicroGo) ErrorUnauthorized ¶
func (m *MicroGo) ErrorUnauthorized(w http.ResponseWriter, r *http.Request)
ErrorUnauthorized : Return Unauthorized response on request error.
Status Code : 401
func (*MicroGo) ErrorUnprocessable ¶
func (m *MicroGo) ErrorUnprocessable(w http.ResponseWriter, r *http.Request)
ErrorUnprocessable : Return Unprocessable entity HTTP response.
Status Code 422.
func (*MicroGo) ListenAndServe ¶
func (m *MicroGo) ListenAndServe()
ListenAndServe starts the application web server
func (*MicroGo) MigrateDownAll ¶
func (*MicroGo) MigrateForce ¶
func (*MicroGo) New ¶
New reads the .env file, creates our application config, populates the MicroGo type with settings based on .env values, and creates the necessary folders and files if they don't exist on the system.
func (*MicroGo) SentFile ¶
func (m *MicroGo) SentFile(w http.ResponseWriter, r *http.Request, fileLocation, fileName string) error
SentFile : Send a file on response.
type Validation ¶
func (*Validation) AddError ¶
func (v *Validation) AddError(key, message string)
func (*Validation) Check ¶
func (v *Validation) Check(ok bool, key, message string)
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) Valid ¶
func (v *Validation) Valid() bool