server

package
v0.0.0-...-1561ecf Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultInternalError = `` /* 181-byte string literal not displayed */

)

DefaultInternalError JSON string response

Variables

View Source
var (
	// Database export glbal connection
	Database model.DB

	//Logger global way to log things
	Logger logger
)

Functions

func Start

func Start()

Start func start server process and init all config server options

Types

type ArticlePayload

type ArticlePayload struct {
	Data struct {
		ID         uint64 `json: "ID"`
		Title      string `json: "Title"`
		Time       string `json: "Time"`
		Author     string `json: "Author"`
		Content    string `json: "Content"`
		IDCategory uint64 `json: "ID_Category"`
	}
}

ArticlePayload struct type to decode incomming post/put request body json

type CategoryPayload

type CategoryPayload struct {
	Data struct {
		ID   uint64 `json: "ID"`
		Name string `json: "Name"`
	}
}

CategoryPayload struct type to decode incomming post/put request body json

type ErrData

type ErrData struct {
	Message string
}

ErrData hold the body json that will be written to the ReponseWriter

type ErrServer

type ErrServer struct {
	Data ErrData
}

ErrServer playload does not implment the error interface because we use just to fill the http response body

func NewErrServer

func NewErrServer(msg string) ErrServer

NewErrServer returns a new ErrServer struct for marshaling json

func (ErrServer) JSON

func (e ErrServer) JSON() []byte

JSON func returns indent json serialized It's a wrapper around MarshalIndent using just "" and " " for indentation

Jump to

Keyboard shortcuts

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