aboutsummaryrefslogtreecommitdiff
path: root/modules/base/base.go
diff options
context:
space:
mode:
authorMeaglith Ma <genedna@gmail.com>2014-04-23 12:29:53 +0800
committerMeaglith Ma <genedna@gmail.com>2014-04-23 12:29:53 +0800
commitee7bfe2ebe3a453beff5e8d4c1436061d321acfe (patch)
tree02575fe703fdcfaa2bd6450b852734d9305c9ce6 /modules/base/base.go
parentb270b34c98b10b0e4807048890e883b6b06a6461 (diff)
parentf0cdf30134e62be6bf5924735a6145769e495cfc (diff)
Add memcached and redis Docker supported
Diffstat (limited to 'modules/base/base.go')
-rw-r--r--modules/base/base.go48
1 files changed, 48 insertions, 0 deletions
diff --git a/modules/base/base.go b/modules/base/base.go
index 7c08dcc5..3e80a436 100644
--- a/modules/base/base.go
+++ b/modules/base/base.go
@@ -8,3 +8,51 @@ type (
// Type TmplData represents data in the templates.
TmplData map[string]interface{}
)
+
+// __________.__ .___.__
+// \______ \__| ____ __| _/|__| ____ ____
+// | | _/ |/ \ / __ | | |/ \ / ___\
+// | | \ | | \/ /_/ | | | | \/ /_/ >
+// |______ /__|___| /\____ | |__|___| /\___ /
+// \/ \/ \/ \//_____/
+
+// Errors represents the contract of the response body when the
+// binding step fails before getting to the application.
+type BindingErrors struct {
+ Overall map[string]string `json:"overall"`
+ Fields map[string]string `json:"fields"`
+}
+
+// Total errors is the sum of errors with the request overall
+// and errors on individual fields.
+func (err BindingErrors) Count() int {
+ return len(err.Overall) + len(err.Fields)
+}
+
+func (this *BindingErrors) Combine(other BindingErrors) {
+ for key, val := range other.Fields {
+ if _, exists := this.Fields[key]; !exists {
+ this.Fields[key] = val
+ }
+ }
+ for key, val := range other.Overall {
+ if _, exists := this.Overall[key]; !exists {
+ this.Overall[key] = val
+ }
+ }
+}
+
+const (
+ BindingRequireError string = "Required"
+ BindingAlphaDashError string = "AlphaDash"
+ BindingMinSizeError string = "MinSize"
+ BindingMaxSizeError string = "MaxSize"
+ BindingEmailError string = "Email"
+ BindingUrlError string = "Url"
+ BindingDeserializationError string = "DeserializationError"
+ BindingIntegerTypeError string = "IntegerTypeError"
+ BindingBooleanTypeError string = "BooleanTypeError"
+ BindingFloatTypeError string = "FloatTypeError"
+)
+
+var GoGetMetas = make(map[string]bool)