Documentation ¶
Index ¶
- Constants
- Variables
- func AddSwaggerDELETEPath(path string, swaggerPath Swagger2Path) error
- func AddSwaggerDefinition(name string, swaggerSchema Swagger2Schema) error
- func AddSwaggerGETPath(path string, swaggerPath Swagger2Path) error
- func AddSwaggerPOSTPath(path string, swaggerPath Swagger2Path) error
- func AddSwaggerPUTPath(path string, swaggerPath Swagger2Path) error
- func AddSwaggerTag(name string, description string, docDescription string, docURL string) error
- func GetDBIndexes(x interface{}) map[string]string
- func GetReflectionFieldValue(key string, x interface{}) string
- func GetStructReflectionValue(key string, val reflect.Value) string
- func GetSwaggerDefinitionJSONString() string
- func GetValidationTags(x interface{}) map[string]string
- func Initialize() error
- func LoadSwaggerTemplate()
- func OverrideMongoDBConnection(connectionString string, dbName string)
- func ReadMongoDB() (mdb *mgo.Database)
- func RunDBCreate()
- func SetFieldValue(key string, val reflect.Value, value interface{})
- type CacheKey
- type CacheValue
- type CollectionCache
- func (cc CollectionCache) Count() (value int)
- func (cc CollectionCache) DeleteAll()
- func (cc CollectionCache) Fetch(collection string, id string, value interface{}) (ok bool)
- func (cc CollectionCache) Remove(collection string, id string)
- func (cc CollectionCache) Store(collection string, id string, value interface{})
- type FieldType
- type FieldValidation
- type Mongo_Replica_Member
- type Mongo_Replica_Setting
- type Mongo_Result_Repl_Conf
- type NOSQLCollection
- type NOSQLSchema
- type NOSQLSchemaDB
- type NOSQLSchemaField
- type SchemaNameSorter
- type Swagger2
- type Swagger2Contact
- type Swagger2ExternalDoc
- type Swagger2Header
- type Swagger2Info
- type Swagger2Item
- type Swagger2License
- type Swagger2Operation
- type Swagger2Parameter
- type Swagger2Path
- type Swagger2Response
- type Swagger2Schema
- type Swagger2SecurityScheme
- type Swagger2Tag
Constants ¶
const ( ERROR_CODE_VALIDATION_REQUIRED = "required" ERROR_CODE_VALIDATION_EMAIL = "notValidEmail" ERROR_CODE_VALIDATION = "validationFailed" ERROR_CODE_TRANSACTION_NOT_PRESENT = "transactionNotPresent" ERROR_CODE_TRANSACTION_RECORD_NOT_EXISTS = "transactionNoRecordExists" VALIDATION_TYPE_EMAIL = "email" SCHEMA_ID_FIELD = "Id" )
const ( //Driver Types DATABASE_DRIVER_BOLTDB = "boltDB" DATABASE_DRIVER_MONGODB = "mongoDB" )
const CURRENT_SWAGGER_VERSION = "2.0"
const SWAGGER_SCHEMA_PATH = "src/github.com/DanielRenne/GoCore/swagger/schemas"
Variables ¶
var BoltDB *storm.DB
var DB *sql.DB
var DBMutex *sync.RWMutex
var MongoDB *mgo.Database
var MongoSession *mgo.Session
Functions ¶
func AddSwaggerDELETEPath ¶
func AddSwaggerDELETEPath(path string, swaggerPath Swagger2Path) error
func AddSwaggerDefinition ¶
func AddSwaggerDefinition(name string, swaggerSchema Swagger2Schema) error
func AddSwaggerGETPath ¶
func AddSwaggerGETPath(path string, swaggerPath Swagger2Path) error
func AddSwaggerPOSTPath ¶
func AddSwaggerPOSTPath(path string, swaggerPath Swagger2Path) error
func AddSwaggerPUTPath ¶
func AddSwaggerPUTPath(path string, swaggerPath Swagger2Path) error
func AddSwaggerTag ¶
func GetDBIndexes ¶
GetIndexes provides a way to reflect on your structure to get structs tagged with `dbIndex`. This function is used to generate Indexes for MongoDB and other databases.
func GetReflectionFieldValue ¶
func GetSwaggerDefinitionJSONString ¶
func GetSwaggerDefinitionJSONString() string
func GetValidationTags ¶
GetValidationTags provides a way to reflect on your structure to get structs tagged with `dbIndex`. This function is used to generate Indexes for MongoDB and other databases.
func Initialize ¶
func Initialize() error
func LoadSwaggerTemplate ¶
func LoadSwaggerTemplate()
func ReadMongoDB ¶
func RunDBCreate ¶
func RunDBCreate()
func SetFieldValue ¶
Types ¶
type CacheKey ¶
type CacheKey struct {
// contains filtered or unexported fields
}
CacheKey is the key lookup for the collectionCache
type CacheValue ¶
type CacheValue struct {
// contains filtered or unexported fields
}
CacheValue is the value for the collectionCache
type CollectionCache ¶
type CollectionCache struct { }
CollectionCache provides DB object Caching functions.
func (CollectionCache) Count ¶
func (cc CollectionCache) Count() (value int)
Count returns the length of the cache.
func (CollectionCache) DeleteAll ¶ added in v1.1.1
func (cc CollectionCache) DeleteAll()
DeleteAll deletes the whole collection cache
func (CollectionCache) Fetch ¶
func (cc CollectionCache) Fetch(collection string, id string, value interface{}) (ok bool)
Fetch will get the collection entity
func (CollectionCache) Remove ¶
func (cc CollectionCache) Remove(collection string, id string)
Remove will remove from the collection cache.
func (CollectionCache) Store ¶
func (cc CollectionCache) Store(collection string, id string, value interface{})
Store will store the collection object.
type FieldValidation ¶
type Mongo_Replica_Member ¶
type Mongo_Replica_Setting ¶
type Mongo_Result_Repl_Conf ¶
type Mongo_Result_Repl_Conf struct { Config struct { Id string `bson:"_id"` Version int `bson:"version"` Members []Mongo_Replica_Member `bson:"members"` Settings Mongo_Replica_Setting `bson:"settings"` } `bson:"config"` }
type NOSQLCollection ¶
type NOSQLCollection struct { Name string `json:"name"` ClearTable bool `json:"clearTable"` Schema NOSQLSchema `json:"schema"` FieldTypes map[string]FieldType }
type NOSQLSchema ¶
type NOSQLSchema struct { Name string `json:"name"` Fields []NOSQLSchemaField `json"fields"` }
type NOSQLSchemaDB ¶
type NOSQLSchemaDB struct {
Collections []NOSQLCollection `json:"collections"`
}
type NOSQLSchemaField ¶
type NOSQLSchemaField struct { Name string `json:"name"` Type string `json:"type"` Index string `json:"index"` View bool `json:"view"` Ref string `json:"ref"` Format string `json:"format"` OmitEmpty bool `json:"omitEmpty"` DefaultValue string `json:"defaultValue"` Required bool `json:"required"` Schema NOSQLSchema `json:"schema"` Validation *FieldValidation `json:"validate, omitempty"` Join join `json:"join"` NoPersist bool `json:"noPersist"` }
type SchemaNameSorter ¶
type SchemaNameSorter []NOSQLCollection
AxisSorter sorts planets by axis.
func (SchemaNameSorter) Len ¶
func (a SchemaNameSorter) Len() int
func (SchemaNameSorter) Less ¶
func (a SchemaNameSorter) Less(i, j int) bool
func (SchemaNameSorter) Swap ¶
func (a SchemaNameSorter) Swap(i, j int)
type Swagger2 ¶
type Swagger2 struct { sync.RWMutex Swagger string `json:"swagger"` Info *Swagger2Info `json:"info"` Host string `json:"host,omitempty"` BasePath string `json:"basePath,omitempty"` Tags []Swagger2Tag `json:"tags,omitempty"` Schemes []string `json:"schemes,omitempty"` Paths map[string]Swagger2Path `json:"paths,omitempty"` Definitions map[string]Swagger2Schema `json:"definitions,omitempty"` Parameters map[string]Swagger2Parameter `json:"parameters,omitempty"` Responses map[string]Swagger2Response `json:"responses,omitempty"` SecurityDefinitions map[string]Swagger2SecurityScheme `json:"securityDefinitions,omitempty"` Security []map[string][]string `json:"security,omitempty"` ExternalDocs *Swagger2ExternalDoc `json:"externalDocs,omitempty"` }
var SwaggerDefinition Swagger2
type Swagger2Contact ¶
type Swagger2ExternalDoc ¶
type Swagger2Header ¶
type Swagger2Header struct { Description string `json:"description"` Type string `json:"type"` Format string `json:"format,omitempty"` Items *Swagger2Item `json:"items,omitempty"` CollectionFormat string `json:"collectionFormat,omitempty"` Maximum float64 `json:"maximum,omitempty"` ExclusiveMaximum bool `json:"exclusiveMaximum"` Minimum float64 `json:"minimum,omitempty"` ExclusiveMinimum bool `json:"exclusiveMinimum"` MaxLength int `json:"maxLength,omitempty"` MinLength int `json:"minLength,omitempty"` Pattern string `json:"pattern,omitempty"` MaxItems int `json:"maxItems,omitempty"` MinItems int `json:"minItems,omitempty"` UniqueItems bool `json:"uniqueItems,omitempty"` MultipleOf float64 `json:"multipleOf,omitempty"` }
type Swagger2Info ¶
type Swagger2Info struct { Title string `json:"title"` Description string `json:"description,omitempty"` TermsOfService string `json:"termsOfService,omitempty"` Contact *Swagger2Contact `json:"contact,omitempty"` License *Swagger2License `json:"license,omitempty"` Version string `json:"version,omitempty"` }
type Swagger2Item ¶
type Swagger2Item struct { Ref string `json:"$ref,omitempty"` Type string `json:"type,omitempty"` Format string `json:"format,omitempty"` Items *Swagger2Item `json:"items,omitempty"` CollectionFormat string `json:"collectionFormat,omitempty"` Maximum float64 `json:"maximum,omitempty"` ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"` Minimum float64 `json:"minimum,omitempty"` ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"` MaxLength int `json:"maxLength,omitempty"` MinLength int `json:"minLength,omitempty"` Pattern string `json:"pattern,omitempty"` MaxItems int `json:"maxItems,omitempty"` MinItems int `json:"minItems,omitempty"` UniqueItems bool `json:"uniqueItems,omitempty"` MultipleOf float64 `json:"multipleOf,omitempty"` }
type Swagger2License ¶
type Swagger2Operation ¶
type Swagger2Operation struct { Responses map[string]Swagger2Response `json:"responses"` Tags []string `json:"tags,omitempty"` Summary string `json:"summary,omitempty"` Description string `json:"description,omitempty"` OperationId string `json:"operationId,omitempty"` Consumes []string `json:"consumes,omitempty"` Produces []string `json:"produces,omitempty"` Parameters []Swagger2Parameter `json:"parameters,omitempty"` Schemes []string `json:"schemes,omitempty"` Deprecated bool `json:"deprecated,omitempty"` Security []map[string][]string `json:"security,omitempty"` }
type Swagger2Parameter ¶
type Swagger2Parameter struct { In string `json:"in"` Name string `json:"name"` Description string `json:"description,omitempty"` Required bool `json:"required,omitempty"` Schema *Swagger2Schema `json:"schema,omitempty"` Type string `json:"type,omitempty"` Format string `json:"format,omitempty"` AllowEmptyValue bool `json:"allowEmptyValue,omitempty"` Items *Swagger2Item `json:"items,omitempty"` CollectionFormat string `json:"collectionFormat,omitempty"` Maximum float64 `json:"maximum,omitempty"` ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"` Minimum float64 `json:"minimum,omitempty"` ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"` MaxLength int `json:"maxLength,omitempty"` MinLength int `json:"minLength,omitempty"` Pattern string `json:"pattern,omitempty"` MaxItems int `json:"maxItems,omitempty"` MinItems int `json:"minItems,omitempty"` UniqueItems bool `json:"uniqueItems,omitempty"` MultipleOf float64 `json:"multipleOf,omitempty"` }
type Swagger2Path ¶
type Swagger2Path struct { Ref string `json:"$ref,omitempty"` GET *Swagger2Operation `json:"get,omitempty"` PUT *Swagger2Operation `json:"put,omitempty"` POST *Swagger2Operation `json:"post,omitempty"` DELETE *Swagger2Operation `json:"delete,omitempty"` OPTIONS *Swagger2Operation `json:"options,omitempty"` HEAD *Swagger2Operation `json:"head,omitempty"` PATCH *Swagger2Operation `json:"patch,omitempty"` Parameters []Swagger2Parameter `json:"parameters,omitempty"` }
type Swagger2Response ¶
type Swagger2Response struct { Description string `json:"description"` Schema *Swagger2Schema `json:"schema,omitempty"` Headers map[string]Swagger2Header `json:"headers,omitempty"` Examples string `json:"examples,omitempty"` }
type Swagger2Schema ¶
type Swagger2Schema struct { Ref string `json:"$ref,omitempty"` Description string `json:"description,omitempty"` Type string `json:"type,omitempty"` Format string `json:"format,omitempty"` Items *Swagger2Item `json:"items,omitempty"` Default string `json:"default,omitempty"` MultipleOf float64 `json:"multipleOf,omitempty"` Maximum float64 `json:"maximum,omitempty"` ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"` Minimum float64 `json:"minimum,omitempty"` ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"` MaxLength int `json:"maxLength,omitempty"` MinLength int `json:"minLength,omitempty"` Pattern string `json:"pattern,omitempty"` MaxItems int `json:"maxItems,omitempty"` MinItems int `json:"minItems,omitempty"` UniqueItems bool `json:"uniqueItems,omitempty"` MaxProperties int `json:"maxProperties,omitempty"` MinProperties int `json:"minProperties,omitempty"` Required []string `json:"required,omitempty"` AdditionalProperties []string `json:"additionalProperties,omitempty"` Properties map[string]Swagger2Schema `json:"properties,omitempty"` }
type Swagger2SecurityScheme ¶
type Swagger2SecurityScheme struct { Type string `json:"type"` Description string `json:"description,omitempty"` Name string `json:"name"` In string `json:"in"` Flow string `json:"flow"` AuthorizationURL string `json:"authorizationUrl"` TokenURL string `json:"tokenUrl"` Scopes map[string]string `json:"scopes"` }
type Swagger2Tag ¶
type Swagger2Tag struct { Name string `json:"name"` Description string `json:"description,omitempty"` ExternalDocs *Swagger2ExternalDoc `json:"externalDocs,omitempty"` }