Documentation ¶
Overview ¶
Package mongo provides Datatables handlers for MongoDB.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFilter ¶
CreateFilter creates a BSON query from a Datatables Request.
Types ¶
type Collection ¶
Collection interface contains the *mgo.Collection methods used.
type CollectionHandler ¶
type CollectionHandler struct {
Collection Collection
}
CollectionHandler provides a HTTP handler for a mgo collection.
Example ¶
session, _ := mgo.Dial("mymongohost") c := session.DB("mydb").C("mycollection") http.Handle("/mycollection", NewCollectionHandler(c)) http.ListenAndServe(":8080", nil)
Output:
func NewCollectionHandler ¶
func NewCollectionHandler(c *mgo.Collection) *CollectionHandler
NewCollectionHandler returns a CollectionHandler for the given collection.
func (*CollectionHandler) ServeHTTP ¶
func (ch *CollectionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface
type Query ¶
type Query interface { All(result interface{}) error Count() (n int, err error) Limit(n int) Query Skip(n int) Query Sort(fields ...string) Query }
Query interface defines the *mgo.Query methods used.
func RangeQuery ¶
RangeQuery sets range of items to return based on the Datatables Request.
Click to show internal directories.
Click to hide internal directories.