Ejemplo n.º 1
0
// IsArrayResponse validates if the specified JSON document
// is an array or slice
func IsArrayResponse(doc []byte) bool {
	tracelog.STARTED("utils", "IsArrayResponse")

	docString := string(doc)
	docSlice := strings.TrimLeft(docString, " ")

	if len(docSlice) > 0 && string(docSlice[0]) == "[" {
		tracelog.COMPLETEDf("utils", "IsArrayReponse", "Doc is Array")
		return true
	}

	tracelog.COMPLETEDf("utils", "IsArrayResponse", "Doc is not Array")
	return false
}
Ejemplo n.º 2
0
// Finish is called once the baseController method completes
func (baseController *BaseController) Finish() {
	defer func() {
		if baseController.MongoSession != nil {
			mongo.CloseSession(baseController.UserId, baseController.MongoSession)
			baseController.MongoSession = nil
		}
	}()

	tracelog.COMPLETEDf(baseController.UserId, "Finish", baseController.Ctx.Request.URL.Path)
}
Ejemplo n.º 3
0
// Finish is called once the controller method completes
func (this *BaseController) Finish() {
	defer func() {
		if this.MongoSession != nil {
			mongo.CloseSession(this.UserId, this.MongoSession)
			this.MongoSession = nil
		}
	}()

	tracelog.COMPLETEDf(this.UserId, "Finish", this.Ctx.Request.URL.Path)
}