few linting items

This commit is contained in:
Jeffrey Paul 2019-11-07 12:54:49 -08:00
parent f68a770cf0
commit 5e4e253f58
3 changed files with 10 additions and 8 deletions

View File

@ -11,11 +11,11 @@ import "github.com/rs/zerolog/log"
import "github.com/sneak/merp/models"
func thingRegex() *regexp.Regexp {
THING_REGEX, e := regexp.Compile(`^[a-zA-Z0-9\_\-]+$`)
ThingRegex, e := regexp.Compile(`^[a-zA-Z0-9\_\-]+$`)
if e != nil {
panic(e)
}
return THING_REGEX
return ThingRegex
}
func decodeJson(in []byte) interface{} {

View File

@ -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
}

View File

@ -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)"`