web

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2017 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeMARKDOWN markdown format
	TypeMARKDOWN = "markdown"
	// TypeHTML html format
	TypeHTML = "html"
	// TypeTEXT text format
	TypeTEXT = "text"
)

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 Backend

func Backend() string

Backend backend home

func Config

func Config(f cli.ActionFunc) cli.ActionFunc

Config load config first

func DataSource

func DataSource() string

DataSource datasource url

func Frontend

func Frontend() string

Frontend frontend home

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 Walk

func Walk(f func(Plugin) error) error

Walk walk plugins

func Wrap

func Wrap(f func(*gin.Context) error) gin.HandlerFunc

Wrap wrap handler

Types

type HTTPError

type HTTPError struct {
	Message string
	Status  int
}

HTTPError http error

func (*HTTPError) Error

func (p *HTTPError) Error() string

type Media

type Media struct {
	Model
	Body string `json:"body"`
	Type string `json:"type"`
}

Media media

type Model

type Model struct {
	Timestamp
	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(rt *gin.Engine)
	Open(*inject.Graph) error
	Console() []cli.Command
	Atom(lang string) ([]*atom.Entry, error)
	Sitemap() ([]stm.URL, error)
	Workers() map[string]job.Handler
}

Plugin plugin

type Timestamp

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

Timestamp timestamp

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