few linting items
This commit is contained in:
13
models/db.go
13
models/db.go
@@ -8,17 +8,17 @@ import _ "github.com/lib/pq"
|
||||
|
||||
var ormObject orm.Ormer
|
||||
|
||||
func Initialize() {
|
||||
func initialize() {
|
||||
if os.Getenv("DEBUG") != "" {
|
||||
orm.Debug = true
|
||||
}
|
||||
|
||||
ConnectToDb()
|
||||
SyncDB()
|
||||
connectToDb()
|
||||
syncDB()
|
||||
}
|
||||
|
||||
// ConnectToDb - Initializes the ORM and Connection to the postgres DB
|
||||
func ConnectToDb() {
|
||||
func connectToDb() {
|
||||
|
||||
orm.DefaultTimeLoc = time.UTC
|
||||
|
||||
@@ -35,7 +35,8 @@ func ConnectToDb() {
|
||||
|
||||
}
|
||||
|
||||
func SyncDB() {
|
||||
// SyncDB() is responsible for creating the schema in the database
|
||||
func syncDB() {
|
||||
// Database alias.
|
||||
name := "default"
|
||||
|
||||
@@ -55,7 +56,7 @@ func SyncDB() {
|
||||
// GetOrmObject - Getter function for the ORM object with which we can query the database
|
||||
func GetOrmObject() orm.Ormer {
|
||||
if ormObject == nil {
|
||||
Initialize()
|
||||
initialize()
|
||||
}
|
||||
return ormObject
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package models
|
||||
|
||||
import "time"
|
||||
|
||||
// Merps are the primary database item in merp
|
||||
type Merp struct {
|
||||
ID int `orm:"auto;column(id)"`
|
||||
Content string `json:"content" orm:"type(jsonb);column(content)"`
|
||||
|
||||
Reference in New Issue
Block a user