devflag 분리 / gocommon으로 패키지 변경

This commit is contained in:
2023-06-19 16:19:24 +09:00
parent c6c9b7727b
commit 6c41ff18a7
10 changed files with 18 additions and 21 deletions

View File

@ -1,10 +1,9 @@
package common
package gocommon
import (
"context"
"encoding/json"
"errors"
"flag"
"os"
"time"
@ -28,8 +27,6 @@ type ConnectionInfo struct {
Database string
}
var Devflag = flag.Bool("dev", false, "")
type CollectionName string
func ParseObjectID(hexstr string) (out primitive.ObjectID) {
@ -42,7 +39,7 @@ func NewMongoConnectionInfo(url string, dbname string) *ConnectionInfo {
panic("dbname is empty")
}
if *Devflag {
if *devflag {
hostname, _ := os.Hostname()
dbname = hostname + "-" + dbname
}