-
Notifications
You must be signed in to change notification settings - Fork 0
/
globals.go
46 lines (34 loc) · 1.22 KB
/
globals.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package apidCRUD
// this file contains defs that are global to the apidCRUD plugin.
// do not put functions here.
import (
"net/http"
"database/sql"
"github.com/apid/apid-core"
)
// dbType is intended to encapsulate the database handle type.
type dbType struct {
handle *sql.DB
}
// badStat is a convenience constant, the http status for a bad request.
const badStat = http.StatusBadRequest
// db is our global database handle
var db dbType
// log is our global log variable
var log apid.LogService
// the variables below are globals controlled by config file.
// in normal operation, the defaults will be overridden
// when initPlugin() calls initConfig().
//
// during unit tests, TestMain() calls initConfig() with
// a fake config reader to do the initialization.
// dbName is the name of the database that is implicitly used in these APIs.
var dbName = "apidCRUD.db"
// dbDriver is the name of the database driver to use
var dbDriver = "sqlite3"
// basePath is the prefix applied to paths in the API description table
var basePath = "/apid"
// maxRecs is the max number of results allowed in a bulk request.
var maxRecs = 1000
// tobleOfTables is the name of the internal table of table names/schemas
var tableOfTables = "_tables_"