Documentation ¶
Index ¶
- type API
- func (api *API) Abort(rw http.ResponseWriter, statusCode int)
- func (api *API) AddNonJSONResource(db *gorm.DB, resource NonJSONResource, path string)
- func (api *API) AddResource(db *gorm.DB, resource Resource, path string)
- func (api *API) Init(db *gorm.DB)
- func (api *API) Start(inetaddr string, port int)
- type NonJSONData
- type NonJSONResource
- type Resource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct{}
API is the generic "API" model
func (*API) Abort ¶
func (api *API) Abort(rw http.ResponseWriter, statusCode int)
Abort just return the status code
func (*API) AddNonJSONResource ¶
func (api *API) AddNonJSONResource(db *gorm.DB, resource NonJSONResource, path string)
AddNonJSONResource will add a non json Handler
func (*API) AddResource ¶
AddResource add path to the http Handler
type NonJSONData ¶
type NonJSONData interface { GetContentType() string GetContentLength() string GetContent() []byte }
NonJSONData represent any content that is not JSon, mostly images
type NonJSONResource ¶
type NonJSONResource interface { Get(db *gorm.DB, values url.Values, id int) (int, interface{}) Post(db *gorm.DB, values url.Values, request *http.Request, id int, adj string) (int, interface{}) Put(db *gorm.DB, values url.Values, body io.ReadCloser) (int, interface{}) Delete(db *gorm.DB, values url.Values, id int) (int, interface{}) }
NonJSONResource hold the files images and other objects
type Resource ¶
type Resource interface { Get(db *gorm.DB, values url.Values, id int) (int, interface{}) Post(db *gorm.DB, values url.Values, request *http.Request, id int, adj string) (int, interface{}) Put(db *gorm.DB, values url.Values, body io.ReadCloser) (int, interface{}) Delete(db *gorm.DB, values url.Values, id int) (int, interface{}) }
Resource will define the generic API resource methods
Click to show internal directories.
Click to hide internal directories.