mvc

package module
v0.0.0-...-aae399f Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 7 Imported by: 0

README

mvc

mvc for nico.

Documentation

Overview

Router

* 2 * @Author: Nico 3 * @Date: 2020/11/8 17:53 4

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Router

func Router(url string, middleware ...HandlerFunc) *router

Types

type Config

type Config struct {
}

type ContentType

type ContentType string
const (
	ContentTypePostForm ContentType = "application/x-www-form-urlencoded"
	ContentTypeFormData ContentType = "multipart/form-data"
	ContentTypeJSON     ContentType = "application/json"
	ContentTypeXML      ContentType = "application/xml"
)

type Context

type Context struct {
}

type Driver

type Driver interface {
	Run(addr ...string) error
	Handle(method Method, url string, middleware ...HandlerFunc)
}

type HandlerFunc

type HandlerFunc interface{}

type JSON

type JSON interface {
	Marshal(v interface{}) ([]byte, error)
	Unmarshal(data []byte, v interface{}) error
}

func DefaultJSON

func DefaultJSON() JSON

type Method

type Method string
const (
	MethodGet     Method = "GET"
	MethodHead    Method = "HEAD"
	MethodPost    Method = "POST"
	MethodPut     Method = "PUT"
	MethodDelete  Method = "DELETE"
	MethodConnect Method = "CONNECT"
	MethodOptions Method = "OPTIONS"
	MethodTrace   Method = "TRACE"
	MethodPatch   Method = "PATCH"
)

type Mvc

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

func New

func New(r *router, d Driver, options ...Option) *Mvc

func (*Mvc) Driver

func (m *Mvc) Driver(driver Driver) *Mvc

func (*Mvc) Run

func (m *Mvc) Run(addr ...string) error

func (*Mvc) Use

func (m *Mvc) Use(options ...Option) *Mvc

type Option

type Option interface {
	Option(mvc *Mvc)
}

type Serial

type Serial interface {
	Serial(dest interface{}) string
	DeSerial(src interface{}, t reflect.Type) (interface{}, error)
}

func DefaultSerial

func DefaultSerial(jsons ...JSON) Serial

type Validator

type Validator interface {
	Validate(s interface{}) error
}

func DefaultValidator

func DefaultValidator() Validator

Directories

Path Synopsis
driver
gin
test
gin

Jump to

Keyboard shortcuts

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