Documentation
¶
Index ¶
Constants ¶
View Source
const ( //WEEK_SECONDS meas the seconds of a week WEEK_SECONDS = 604800 // 7 * 24 * 3600 //MONTH_SECONDS meas the seconds of a month MONTH_SECONDS = 259200 // 30 * 24 * 3600 )
Variables ¶
View Source
var BakCtx = RestContext{
KeyPath: "/root/readygo_keys/api.readygo.miosolo.top.key",
CrtPath: "/root/readygo_keys/api.readygo.miosolo.top.crt",
MongoURI: "mongodb://readygo-test:readygo2019@miosolo.top:8017",
MongoDBName: "readygo",
RedisURL: "miosolo.top:8079",
RedisPass: "readygo2019",
}
BakCtx is the default config in production env
View Source
var RCTest = RestContext{ KeyPath: strings.Join([]string{os.Getenv("GOPATH"), "src", "github.com", "miosolo", "readygo", "test", "test.key"}, string(os.PathSeparator)), CrtPath: strings.Join([]string{os.Getenv("GOPATH"), "src", "github.com", "miosolo", "readygo", "test", "test.crt"}, string(os.PathSeparator)), MongoURI: "mongodb://readygo-test:readygo2019@miosolo.top:8017", MongoDBName: "readygo", RedisURL: "miosolo.top:8079", RedisPass: "readygo2019", }
RCTest is the defult test config of test env
Functions ¶
func EnrichSwaggerObject ¶
EnrichSwaggerObject support function
Types ¶
type Asset ¶
type Asset struct { Name string `json:"name" description:"unique name in its base space"` Base string `json:"base" description:"the base space it lies in" default:"base"` Rx float64 `json:"rx" description:"relative x axis value of the parent space"` Ry float64 `json:"ry" description:"relative y axis value of the parent space"` Weight float64 `json:"weight" description:"global weight in sampling" default:"1.0"` }
Asset defines the asset belonging to a space as a Go struct
type CheckResource ¶
CheckResource is the REST layer to access Asset and Space
func (*CheckResource) WebService ¶
func (c *CheckResource) WebService(r *RestContext) *restful.WebService
WebService creates a new service that can handle REST requests.
type RestContext ¶
type RestContext struct { KeyPath string CrtPath string // HTTPS crt and key, signed to api.readygo.miosolo.top MongoURI string // URI to connect mongoDB MongoDBName string RedisURL string // URL of Redis Server RedisPass string // contains filtered or unexported fields }
RestContext : Restful API context on system
func (*RestContext) InitEnv ¶
func (r *RestContext) InitEnv() (err error)
InitEnv : check and try to correct the RestContext and connet to DB servers
func (RestContext) LoadDemoData ¶
func (r RestContext) LoadDemoData() error
LoadDemoData loads the demo data to mongoDB if demo flag is enabled (after r.InitEnv())
func (RestContext) UnloadDemoData ¶
func (r RestContext) UnloadDemoData()
UnloadDemoData deletes all the demo data of on DB
type Space ¶
type Space struct { Name string `json:"name" description:"global unique name of the space"` Base string `json:"base" description:" the parent space it lies in" default:"base"` Rx float64 `json:"rx" description:"relative x axis value of the parent space"` Ry float64 `json:"ry" description:"relative y axis value of the parent space"` }
Space defines the space as a Go struct
Source Files
¶
Click to show internal directories.
Click to hide internal directories.