config

package
v0.0.0-...-80a2261 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const CSRF_KEY = "csrf_token"
View Source
const SESSION_ID = "id"

Variables

View Source
var DateDisplay = "2006-01-02"
View Source
var DateTimeDisplay = "2006-01-02 15:04:05"
View Source
var E = echo.New()
View Source
var ECSRF = middleware.CSRFWithConfig(middleware.CSRFConfig{

	TokenLookup: "form:" + CSRF_KEY,
	ContextKey:  CSRF_KEY,
})

** * CSRF bawaan echo * e.Use(ECSRF) * Digunakan di route web *

View Source
var Footer = "footer"
View Source
var FormErrors map[string]interface{}
View Source
var GCSRF = csrf.Protect(
	[]byte("AB4F63F9AC65152575886860DDE480A1"),
	csrf.RequestHeader(CSRF_KEY),
	csrf.FieldName(CSRF_KEY),

	csrf.ErrorHandler(http.HandlerFunc(serverError403)),
)

*** * gorilla csrf * Dipasang di route web yang ingin dengan csrf *

View Source
var GetJson map[string]m
View Source
var Header = "header"
View Source
var Layout = "main-layout"
View Source
var Modals = "modals"
View Source
var Navbar = "navbar"
View Source
var Popup = "popup"
View Source
var SessionStore = newCookieStore()

pilih session yang digunakan

View Source
var Sidebar = "sidebar"
View Source
var TimeZone = "asia/jakarta"

Functions

func Auth

func Auth(next echo.HandlerFunc) echo.HandlerFunc

func FormErrID

func FormErrID(c echo.Context, a interface{}) error

func GetFlashdata

func GetFlashdata(c echo.Context, name string) []string

func MySQL

func MySQL() (*sql.DB, error)

Menghubungkan ke mysql

func Postgres

func Postgres() (*sql.DB, error)

func SetFlashdata

func SetFlashdata(c echo.Context, name, value string)

func TestPing

func TestPing()

Types

type CustomValidator

type CustomValidator struct {
	// contains filtered or unexported fields
}

custom form validator

func (*CustomValidator) Validate

func (cv *CustomValidator) Validate(i interface{}) error

Jump to

Keyboard shortcuts

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