mvc

package
v0.0.0-...-7690095 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2017 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MVCModule int = iota
	MVCController
	MVCAction
	MVCType
)

Variables

View Source
var (
	CacheDuration = time.Minute * 1 / 60
)

Functions

func AddFuncName

func AddFuncName(names ...string)

func GetFuncMap

func GetFuncMap() (fc template.FuncMap)

func GetHTMLTmpl

func GetHTMLTmpl(p string, fmap template.FuncMap) (t *template.Template, err error)

func GetTemplateRelPath

func GetTemplateRelPath(names Meta, ext string) string

func GetTextFuncMap

func GetTextFuncMap() (fc txtemplate.FuncMap)

func GetTextTmpl

func GetTextTmpl(p string, fmap txtemplate.FuncMap) (t *txtemplate.Template, err error)

func IsSQLID

func IsSQLID(id string) bool

func SQLInsert

func SQLInsert(db SQLExecutor, table string, m interface{}, quoteChar ...string) (sql.Result, error)

func SQLMultiInsert

func SQLMultiInsert(db SQLExecutor, table string, models ...interface{}) (res []sql.Result)

func URLSafeTrashString

func URLSafeTrashString(s string) string

Types

type BaseController

type BaseController struct {
	*web.Context
}

func (*BaseController) Construct_

func (c *BaseController) Construct_(_ *web.Context)

func (*BaseController) Destruct_

func (c *BaseController) Destruct_()

type Controller

type Controller interface {
	Construct_(*web.Context)
	Destruct_()
}

type DataView

type DataView interface {
	SetVMap(...VM)
	SetData(string, interface{})
}

type HTMLTmplView

type HTMLTmplView interface {
	TmplView
	SetGetTmpl(func(fmap template.FuncMap) (t *template.Template, err error))
}

type ID

type ID struct {
	bson.ObjectId `bson:"_id"`
}

func IDFromBase64

func IDFromBase64(b64 string) ID

func NewID

func NewID() ID

func (ID) Base64

func (id ID) Base64() string

func (ID) Hex

func (id ID) Hex() string

func (ID) IDForeign

func (id ID) IDForeign() IDForeign

func (ID) MarshalJSON

func (id ID) MarshalJSON() ([]byte, error)

func (ID) String

func (id ID) String() string

func (*ID) UnmarshalJSON

func (id *ID) UnmarshalJSON(b []byte) (err error)

type IDForeign

type IDForeign string

func (IDForeign) Base64

func (id IDForeign) Base64() string

func (IDForeign) Hex

func (id IDForeign) Hex() string

func (IDForeign) MarshalJSON

func (id IDForeign) MarshalJSON() ([]byte, error)

func (IDForeign) ObjectId

func (id IDForeign) ObjectId() bson.ObjectId

func (IDForeign) String

func (id IDForeign) String() string

type IDType

type IDType interface {
	Base64() string
	Hex() string
}

type Meta

type Meta [4]string

func GetMvcMeta

func GetMvcMeta(ctxt *web.Context) Meta

type Mold

type Mold interface {
	Cast_(string, *web.Context)
	Destroy_()
}

type SQLExecutor

type SQLExecutor interface {
	Prepare(query string) (*sql.Stmt, error)
	Exec(query string, args ...interface{}) (sql.Result, error)
}

type SQLID

type SQLID string

func NewSQLID

func NewSQLID() SQLID

func (*SQLID) Scan

func (id *SQLID) Scan(value interface{}) error

func (SQLID) ToSQLNullID

func (id SQLID) ToSQLNullID() SQLNullID

func (SQLID) Value

func (id SQLID) Value() (driver.Value, error)

type SQLNullBool

type SQLNullBool struct {
	sql.NullBool
}

func (SQLNullBool) MarshalJSON

func (ns SQLNullBool) MarshalJSON() ([]byte, error)

type SQLNullFloat64

type SQLNullFloat64 struct {
	sql.NullFloat64
}

func (SQLNullFloat64) MarshalJSON

func (ns SQLNullFloat64) MarshalJSON() ([]byte, error)

type SQLNullID

type SQLNullID struct {
	sql.NullString
}

func NewSQLNullID

func NewSQLNullID() SQLNullID

func (SQLNullID) MarshalJSON

func (ns SQLNullID) MarshalJSON() ([]byte, error)

type SQLNullInt64

type SQLNullInt64 struct {
	sql.NullInt64
}

func (SQLNullInt64) MarshalJSON

func (ns SQLNullInt64) MarshalJSON() ([]byte, error)

type SQLNullString

type SQLNullString struct {
	sql.NullString
}

func NewSQLNullString

func NewSQLNullString() SQLNullString

func (SQLNullString) MarshalJSON

func (ns SQLNullString) MarshalJSON() ([]byte, error)

type TextTmplView

type TextTmplView interface {
	TmplView
	SetGetTmpl(func(fmap txtemplate.FuncMap) (t *txtemplate.Template, err error))
}

type TmplView

type TmplView interface {
	SetViewFunc(string, interface{})
	SetViewFuncName(string)
}

type VM

type VM map[string]interface{}

type View

type View interface {
	ContentType(*web.Context) string
	Render(*web.Context) ([]byte, error)
	RenderString(*web.Context) (string, error)
	Publish(*web.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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