{"modulePath":"github.com/CHESSComputing/SpecScansService","version":"v0.4.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package main\n\n## Variables\n\n```go\nvar MotorsDb *sql.DB\n```\nvar MotorsDb is our database pointer\n\n```go\nvar QLM ql.QLManager\n```\n\n```go\nvar Schema *schema.Schema\n```\n\n```go\nvar Verbose int\n```\n\n## Functions\n\n```go\nfunc AddHandler(c *gin.Context)\n```\nHandler for adding new records to the database\n\n```go\nfunc Decode[T *MongoRecord | *UserRecord | *map[string]any | *[]map[string]any](record any, record_struct T) error\n```\n\n```go\nfunc DecomposeRecord(user_record UserRecord) (MongoRecord, MotorRecord)\n```\nDecompose a user-submitted scan record into two portions: the portion to reside in the MongoDB, and the motor positions (which will reside in the SQL db).\n\n```go\nfunc EditHandler(c *gin.Context)\n```\nHandler for editing a record already in the database\n\n```go\nfunc InitMotorsDb()\n```\n\n```go\nfunc InitSchemaManager()\n```\n\n```go\nfunc InsertMotors(r MotorRecord, db *sql.DB) (int64, error)\n```\n\n```go\nfunc SearchHandler(c *gin.Context)\n```\nHandler for querying the databases for records\n\n```go\nfunc Server()\n```\nServer defines our HTTP server\n\n## Types\n\n```go\ntype MongoRecord struct {\n\tScanId      string         `json:\"sid\" mapstructure:\"sid\"`\n\tDatasetId   string         `json:\"did\" mapstructure:\"did\"`\n\tCycle       string         `json:\"cycle\" mapstructure:\"cycle\"`\n\tBeamline    string         `json:\"beamline\" mapstructure:\"beamline\"`\n\tBtr         string         `json:\"btr\" mapstructure:\"btr\"`\n\tSpecFile    string         `json:\"spec_file\" mapstructure:\"spec_file\"`\n\tScanNumber  uint16         `json:\"scan_number\" mapstructure:\"scan_number\"`\n\tStartTime   float64        `json:\"start_time\" mapstructure:\"start_time\"`\n\tCommand     string         `json:\"command\" mapstructure:\"command\"`\n\tStatus      string         `json:\"status\" mapstructure:\"status\"`\n\tComments    []string       `json:\"comments\" mapstructure:\"comments\"`\n\tUserlines   []string       `json:\"userlines\" mapstructure:\"userlines\"`\n\tSpecVersion string         `json:\"spec_version\" mapstructure:\"spec_version\"`\n\tVariables   map[string]any `json:\"variables\" mapstructure:\"variables\"`\n}\n```\n\n```go\ntype MotorPositionQuery struct {\n\tMne   string\n\tExact []float64\n\tMin   float64\n\tMax   float64\n}\n```\n\n```go\ntype MotorRecord struct {\n\tScanId string\n\tMotors map[string]float64\n}\n```\n\n```go\nfunc GetMotorRecords(sids ...string) ([]MotorRecord, error)\n```\n\n```go\nfunc QueryMotorPosition(mne string, pos float64) []MotorRecord\n```\n\n```go\nfunc QueryMotorsDb(query map[string]any) []MotorRecord\n```\n\n```go\ntype MotorsDbQuery struct {\n\tSids                 []string\n\tMotorPositionQueries []MotorPositionQuery\n}\n```\n\n```go\ntype UserRecord struct {\n\tScanId      string             `json:\"sid,omitempty\" mapstructure:\"sid,omitempty\"`\n\tDatasetId   string             `json:\"did\" mapstructure:\"did\"`\n\tCycle       string             `json:\"cycle\" mapstructure:\"cycle\"`\n\tBeamline    string             `json:\"beamline\" mapstructure:\"beamline\"`\n\tBtr         string             `json:\"btr\" mapstructure:\"btr\"`\n\tSpecFile    string             `json:\"spec_file\" mapstructure:\"spec_file\"`\n\tScanNumber  uint16             `json:\"scan_number\" mapstructure:\"scan_number\"`\n\tStartTime   float64            `json:\"start_time\" mapstructure:\"start_time\"`\n\tCommand     string             `json:\"command\" mapstructure:\"command\"`\n\tStatus      string             `json:\"status\" mapstructure:\"status\"`\n\tComments    []string           `json:\"comments\" mapstructure:\"comments\"`\n\tUserlines   []string           `json:\"userlines\" mapstructure:\"userlines\"`\n\tSpecVersion string             `json:\"spec_version\" mapstructure:\"spec_version\"`\n\tMotors      map[string]float64 `json:\"motors\" mapstructure:\"motors\"`\n\tVariables   map[string]any     `json:\"variables\" mapstructure:\"variables\"`\n}\n```\n\n```go\nfunc CompleteMongoRecords(mongo_records ...MongoRecord) ([]UserRecord, error)\n```\nReturn the completed UserRecords corresponding to the MongoRecords provided\n\n```go\nfunc CompleteMotorRecords(motor_records ...MotorRecord) ([]UserRecord, error)\n```\nReturn the completed UserRecords correcponding to the MotorRecords provided\n\n```go\nfunc CompleteRecord(mongo_record MongoRecord, motor_record MotorRecord) UserRecord\n```\nCombine a partial scan record with its motor positions, return the completed record\n\n","path":"github.com/CHESSComputing/SpecScansService","name":"main","synopsis":"","isRedistributable":true}
