Initial commit

This commit is contained in:
yan.y
2024-03-27 23:25:08 +08:00
commit 0884384e91
127 changed files with 9353 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
package g
const (
ConfigType = "json" // config's type
ConfigDir = "config" // config's dir
CasbinFileName = "rbac_model.conf" // casbin rule file's name
)
// Status 0:unknown,1:true,2:false
const (
StatusUnknown int = iota
StatusTrue
StatusFalse
)
+26
View File
@@ -0,0 +1,26 @@
package g
import "testing"
func TestCons(t *testing.T) {
t.Run("test constant param", func(t *testing.T) {
if ConfigType != "json" {
t.Errorf("ConfigType want %s but get %s", "json", ConfigType)
}
if ConfigDir != "config" {
t.Errorf("ConfigDir want %s but get %s", "config", ConfigDir)
}
if CasbinFileName != "rbac_model.conf" {
t.Errorf("CasbinFileName want %s but get %s", "rbac_model.conf", CasbinFileName)
}
if StatusUnknown != 0 {
t.Errorf("StatusUnknown want %d but get %d", 0, StatusUnknown)
}
if StatusTrue != 1 {
t.Errorf("StatusTrue want %d but get %d", 1, StatusTrue)
}
if StatusFalse != 2 {
t.Errorf("StatusFalse want %d but get %d", 2, StatusFalse)
}
})
}
+14
View File
@@ -0,0 +1,14 @@
package g
import (
"os"
"strings"
)
var (
TestRedisPwd = strings.TrimSpace(os.Getenv("redisProPwd"))
TestMysqlAddr = strings.TrimSpace(os.Getenv("mysqlAddr"))
TestMysqlPwd = strings.TrimSpace(os.Getenv("mysqlPwd"))
TestMongoAddr = strings.TrimSpace(os.Getenv("mongoAddr"))
TestDbType = strings.TrimSpace(os.Getenv("dbType"))
)