web

package
v0.0.0-...-a0045c4 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2017 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeMARKDOWN markdown format
	TypeMARKDOWN = "markdown"
	// TypeHTML html format
	TypeHTML = "html"
)
View Source
const (
	// FormatDateInput  format for date input
	FormatDateInput = "2006-01-02"
)

Variables

View Source
var (
	// Version version
	Version string
	// BuildTime build time
	BuildTime string
	// Usage usage
	Usage string
	// Copyright copyright
	Copyright string
	// AuthorName author's name
	AuthorName string
	// AuthorEmail author's email
	AuthorEmail string
)

Functions

func Config

func Config(f cli.ActionFunc) cli.ActionFunc

Config load config first

func DataSource

func DataSource() string

DataSource datasource url

func Home

func Home() string

Home home url

func Inject

func Inject(f func(*cli.Context, *inject.Graph) error) cli.ActionFunc

Inject inject objects first

func IsProduction

func IsProduction() bool

IsProduction production mode ?

func Main

func Main() error

Main The entry

func Name

func Name() string

Name get server.name

func Random

func Random(n int) string

Random randome string

func Register

func Register(args ...Plugin)

Register register plugins

func Shell

func Shell(cmd string, args ...string) error

Shell exec shell command

func Template

func Template(w io.Writer, n string, d interface{}) error

Template parse template

func Walk

func Walk(f func(Plugin) error) error

Walk walk plugins

Types

type Model

type Model struct {
	ID        uint      `gorm:"primary_key" json:"id"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Model base model

type Pagination

type Pagination struct {
	Href  string        `json:"href"`
	Page  int64         `json:"page"`
	Size  int64         `json:"size"`
	Total int64         `json:"total"`
	Count int64         `json:"count"`
	Items []interface{} `json:"items"`
	Ids   []int64       `json:"ids"`
}

Pagination pagination

func NewPagination

func NewPagination(r *http.Request, total int64) *Pagination

NewPagination new pagination

func (*Pagination) Limit

func (p *Pagination) Limit() int64

Limit limit

func (*Pagination) Offset

func (p *Pagination) Offset() int64

Offset offset

type Plugin

type Plugin interface {
	Init()
	Mount(*gin.Engine)
	Open(*inject.Graph) error
	Console() []cli.Command
	Atom(lang string) ([]*atom.Entry, error)
	Sitemap(languages ...string) ([]stm.URL, error)
	Workers() map[string]job.Handler
}

Plugin plugin

type Wrap

type Wrap struct {
	Render *render.Render `inject:""`
}

Wrap wrap

func (*Wrap) FORM

func (p *Wrap) FORM(fm interface{}, fn func(*gin.Context, string, interface{}) (interface{}, error)) gin.HandlerFunc

FORM wrap form handler

func (*Wrap) HTML

func (p *Wrap) HTML(t string, f func(*gin.Context, string) (gin.H, error)) gin.HandlerFunc

HTML wrap html render

func (*Wrap) JSON

func (p *Wrap) JSON(f func(*gin.Context, string) (interface{}, error)) gin.HandlerFunc

JSON wrap json render

func (*Wrap) Redirect

func (p *Wrap) Redirect(f func(*gin.Context, string) (string, error)) gin.HandlerFunc

Redirect wrap redirect

func (*Wrap) XML

func (p *Wrap) XML(f func(*gin.Context, string) (interface{}, error)) gin.HandlerFunc

XML wrap xml render

Directories

Path Synopsis
orm
job
orm
fs

Jump to

Keyboard shortcuts

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