Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
MKCLOS
Core Development Platform
coreospackage
Commits
497ad486
Commit
497ad486
authored
7 years ago
by
Ajit Jagtap
Browse files
Options
Downloads
Plain Diff
Merge branch 'stagingbranch' into 'master'
Stagingbranch See merge request
!6
parents
f56ee4aa
2c78f0e4
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!6
Stagingbranch
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
.gitignore
+4
-2
.gitignore
GoGetScript.sh
+62
-62
GoGetScript.sh
InstallLogs.txt
+4
-0
InstallLogs.txt
cacheHelper.go
+63
-55
cacheHelper.go
configHelper.go
+10
-16
configHelper.go
dalMySQL.go
+1
-3
dalMySQL.go
dalNoSQL.go
+2
-3
dalNoSQL.go
dalRedis.go
+1
-3
dalRedis.go
dataConvertor.go
+0
-0
dataConvertor.go
echoHelper.go
+0
-0
echoHelper.go
glide.yaml
+2
-1
glide.yaml
loggingHelper.go
+1
-1
loggingHelper.go
smsHelper.go
+1
-2
smsHelper.go
validationHelper.go
+1
-2
validationHelper.go
with
152 additions
and
150 deletions
.gitignore
+
4
−
2
View file @
497ad486
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*.a
*.a
*.so
*.so
InstallLogs
.txt
*
.txt
# Folders
# Folders
_obj
_obj
...
@@ -23,4 +23,6 @@ _testmain.go
...
@@ -23,4 +23,6 @@ _testmain.go
*.exe
*.exe
*.test
*.test
*.bench
*.bench
\ No newline at end of file
vendor
\ No newline at end of file
This diff is collapsed.
Click to expand it.
GoGetScript.sh
+
62
−
62
View file @
497ad486
...
@@ -5,25 +5,25 @@ NOW=$(date +"%d-%b-%Y %H:%M:%S")
...
@@ -5,25 +5,25 @@ NOW=$(date +"%d-%b-%Y %H:%M:%S")
echo
$NOW
" : Installed
\"
github.com/allegro/bigcache
\"
"
>>
InstallLogs.txt
echo
$NOW
" : Installed
\"
github.com/allegro/bigcache
\"
"
>>
InstallLogs.txt
#
echo "Installing : \"github.com/spf13/viper\""
echo
"Installing :
\"
github.com/spf13/viper
\"
"
#
go get "github.com/spf13/viper"
go get
"github.com/spf13/viper"
#
echo "Done"
echo
"Done"
#
NOW=$(date +"%d-%b-%Y %H:%M:%S")
NOW
=
$(
date
+
"%d-%b-%Y %H:%M:%S"
)
#
echo $NOW " : Installed \"github.com/spf13/viper\"" >> InstallLogs.txt
echo
$NOW
" : Installed
\"
github.com/spf13/viper
\"
"
>>
InstallLogs.txt
#
echo "Installing : \"github.com/gocraft/dbr\""
echo
"Installing :
\"
github.com/gocraft/dbr
\"
"
#
go get "github.com/gocraft/dbr"
go get
"github.com/gocraft/dbr"
#
echo "Done"
echo
"Done"
#
NOW=$(date +"%d-%b-%Y %H:%M:%S")
NOW
=
$(
date
+
"%d-%b-%Y %H:%M:%S"
)
#
echo $NOW " : Installed \"github.com/gocraft/dbr\"" >> InstallLogs.txt
echo
$NOW
" : Installed
\"
github.com/gocraft/dbr
\"
"
>>
InstallLogs.txt
#
echo "Installing : \"gopkg.in/mgo.v2\""
echo
"Installing :
\"
gopkg.in/mgo.v2
\"
"
#
go get "gopkg.in/mgo.v2"
go get
"gopkg.in/mgo.v2"
#
echo "Done"
echo
"Done"
#
NOW=$(date +"%d-%b-%Y %H:%M:%S")
NOW
=
$(
date
+
"%d-%b-%Y %H:%M:%S"
)
#
echo $NOW " : Installed \"gopkg.in/mgo.v2\"" >> InstallLogs.txt
echo
$NOW
" : Installed
\"
gopkg.in/mgo.v2
\"
"
>>
InstallLogs.txt
echo
"Installing :
\"
github.com/garyburd/redigo/redis
\"
"
echo
"Installing :
\"
github.com/garyburd/redigo/redis
\"
"
...
@@ -33,25 +33,25 @@ NOW=$(date +"%d-%b-%Y %H:%M:%S")
...
@@ -33,25 +33,25 @@ NOW=$(date +"%d-%b-%Y %H:%M:%S")
echo
$NOW
" : Installed
\"
github.com/garyburd/redigo/redis
\"
"
>>
InstallLogs.txt
echo
$NOW
" : Installed
\"
github.com/garyburd/redigo/redis
\"
"
>>
InstallLogs.txt
#
echo "Installing : \"github.com/stretchr/testify/assert\""
echo
"Installing :
\"
github.com/stretchr/testify/assert
\"
"
#
go get "github.com/stretchr/testify/assert"
go get
"github.com/stretchr/testify/assert"
#
echo "Done"
echo
"Done"
#
NOW=$(date +"%d-%b-%Y %H:%M:%S")
NOW
=
$(
date
+
"%d-%b-%Y %H:%M:%S"
)
#
echo $NOW " : Installed \"github.com/stretchr/testify/assert\"" >> InstallLogs.txt
echo
$NOW
" : Installed
\"
github.com/stretchr/testify/assert
\"
"
>>
InstallLogs.txt
#
echo "Installing : \"github.com/labstack/echo\""
echo
"Installing :
\"
github.com/labstack/echo
\"
"
#
go get "github.com/labstack/echo"
go get
"github.com/labstack/echo"
#
echo "Done"
echo
"Done"
#
NOW=$(date +"%d-%b-%Y %H:%M:%S")
NOW
=
$(
date
+
"%d-%b-%Y %H:%M:%S"
)
#
echo $NOW " : Installed \"github.com/labstack/echo\"" >> InstallLogs.txt
echo
$NOW
" : Installed
\"
github.com/labstack/echo
\"
"
>>
InstallLogs.txt
#
echo "Installing : \"gopkg.in/mgo.v2/bson\""
echo
"Installing :
\"
gopkg.in/mgo.v2/bson
\"
"
#
go get "gopkg.in/mgo.v2/bson"
go get
"gopkg.in/mgo.v2/bson"
#
echo "Done"
echo
"Done"
#
NOW=$(date +"%d-%b-%Y %H:%M:%S")
NOW
=
$(
date
+
"%d-%b-%Y %H:%M:%S"
)
#
echo $NOW " : Installed \"gopkg.in/mgo.v2/bson\"" >> InstallLogs.txt
echo
$NOW
" : Installed
\"
gopkg.in/mgo.v2/bson
\"
"
>>
InstallLogs.txt
echo
"Installing :
\"
github.com/dgrijalva/jwt-go
\"
"
echo
"Installing :
\"
github.com/dgrijalva/jwt-go
\"
"
...
@@ -61,32 +61,32 @@ NOW=$(date +"%d-%b-%Y %H:%M:%S")
...
@@ -61,32 +61,32 @@ NOW=$(date +"%d-%b-%Y %H:%M:%S")
echo
$NOW
" : Installed
\"
github.com/dgrijalva/jwt-go
\"
"
>>
InstallLogs.txt
echo
$NOW
" : Installed
\"
github.com/dgrijalva/jwt-go
\"
"
>>
InstallLogs.txt
#
echo "Installing : \"github.com/labstack/echo/middleware\""
echo
"Installing :
\"
github.com/labstack/echo/middleware
\"
"
#
go get "github.com/labstack/echo/middleware"
go get
"github.com/labstack/echo/middleware"
#
echo "Done"
echo
"Done"
#
NOW=$(date +"%d-%b-%Y %H:%M:%S")
NOW
=
$(
date
+
"%d-%b-%Y %H:%M:%S"
)
#
echo $NOW " : Installed \"github.com/labstack/echo/middleware\"" >> InstallLogs.txt
echo
$NOW
" : Installed
\"
github.com/labstack/echo/middleware
\"
"
>>
InstallLogs.txt
#
echo "Installing : \"github.com/sirupsen/logrus\""
echo
"Installing :
\"
github.com/sirupsen/logrus
\"
"
#
go get "github.com/sirupsen/logrus"
go get
"github.com/sirupsen/logrus"
#
echo "Done"
echo
"Done"
#
NOW=$(date +"%d-%b-%Y %H:%M:%S")
NOW
=
$(
date
+
"%d-%b-%Y %H:%M:%S"
)
#
echo $NOW " : Installed \"github.com/sirupsen/logrus\"" >> InstallLogs.txt
echo
$NOW
" : Installed
\"
github.com/sirupsen/logrus
\"
"
>>
InstallLogs.txt
#
echo "Installing : \"github.com/go-playground/locales/en\""
echo
"Installing :
\"
github.com/go-playground/locales/en
\"
"
#
go get "github.com/go-playground/locales/en"
go get
"github.com/go-playground/locales/en"
#
echo "Done"
echo
"Done"
#
NOW=$(date +"%d-%b-%Y %H:%M:%S")
NOW
=
$(
date
+
"%d-%b-%Y %H:%M:%S"
)
#
echo $NOW " : Installed \"github.com/go-playground/locales/en\"" >> InstallLogs.txt
echo
$NOW
" : Installed
\"
github.com/go-playground/locales/en
\"
"
>>
InstallLogs.txt
#
echo "Installing : \"gopkg.in/go-playground/validator.v9\""
echo
"Installing :
\"
gopkg.in/go-playground/validator.v9
\"
"
#
go get "gopkg.in/go-playground/validator.v9"
go get
"gopkg.in/go-playground/validator.v9"
#
echo "Done"
echo
"Done"
#
NOW=$(date +"%d-%b-%Y %H:%M:%S")
NOW
=
$(
date
+
"%d-%b-%Y %H:%M:%S"
)
#
echo $NOW " : Installed \"gopkg.in/go-playground/validator.v9\"" >> InstallLogs.txt
echo
$NOW
" : Installed
\"
gopkg.in/go-playground/validator.v9
\"
"
>>
InstallLogs.txt
echo
"Installing :
\"
github.com/go-playground/universal-translator
\"
"
echo
"Installing :
\"
github.com/go-playground/universal-translator
\"
"
...
@@ -96,17 +96,17 @@ NOW=$(date +"%d-%b-%Y %H:%M:%S")
...
@@ -96,17 +96,17 @@ NOW=$(date +"%d-%b-%Y %H:%M:%S")
echo
$NOW
" : Installed
\"
github.com/go-playground/universal-translator
\"
"
>>
InstallLogs.txt
echo
$NOW
" : Installed
\"
github.com/go-playground/universal-translator
\"
"
>>
InstallLogs.txt
#
echo "Installing : \"gopkg.in/go-playground/validator.v9/translations/en\""
echo
"Installing :
\"
gopkg.in/go-playground/validator.v9/translations/en
\"
"
#
go get "gopkg.in/go-playground/validator.v9/translations/en"
go get
"gopkg.in/go-playground/validator.v9/translations/en"
#
echo "Done"
echo
"Done"
#
NOW=$(date +"%d-%b-%Y %H:%M:%S")
NOW
=
$(
date
+
"%d-%b-%Y %H:%M:%S"
)
#
echo $NOW " : Installed \"gopkg.in/go-playground/validator.v9/translations/en\"" >> InstallLogs.txt
echo
$NOW
" : Installed
\"
gopkg.in/go-playground/validator.v9/translations/en
\"
"
>>
InstallLogs.txt
#
echo "******************************************"
echo
"******************************************"
#
echo "Installation complete"
echo
"Installation complete"
#
echo "******************************************"
echo
"******************************************"
# NOW=$(date +"%d-%b-%Y %H:%M:%S")
NOW
=
$(
date
+
"%d-%b-%Y %H:%M:%S"
)
# echo "******************************************" >> InstallLogs.txt
echo
"******************************************"
>>
InstallLogs.txt
# echo $NOW "Installation complete" >> InstallLogs.txt
echo
$NOW
"Installation complete"
>>
InstallLogs.txt
# echo "******************************************" >> InstallLogs.txt
echo
"******************************************"
>>
InstallLogs.txt
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
InstallLogs.txt
+
4
−
0
View file @
497ad486
...
@@ -10,3 +10,7 @@
...
@@ -10,3 +10,7 @@
20-Jun-2017 12:37:47 : Installed "github.com/labstack/echo/middleware"
20-Jun-2017 12:37:47 : Installed "github.com/labstack/echo/middleware"
20-Jun-2017 12:39:04 : Installed "github.com/sirupsen/logrus"
20-Jun-2017 12:39:04 : Installed "github.com/sirupsen/logrus"
20-Jun-2017 12:53:39 : Installed "github.com/allegro/bigcache"
20-Jun-2017 12:53:39 : Installed "github.com/allegro/bigcache"
22-Jun-2017 13:45:25 : Installed "github.com/allegro/bigcache"
22-Jun-2017 13:45:26 : Installed "github.com/garyburd/redigo/redis"
22-Jun-2017 13:45:26 : Installed "github.com/dgrijalva/jwt-go"
22-Jun-2017 13:45:53 : Installed "github.com/go-playground/universal-translator"
This diff is collapsed.
Click to expand it.
cacheHelper.go
+
63
−
55
View file @
497ad486
package
coreos
package
coreos
import
(
import
(
"GolangFullStack/server/api/server/config"
"fmt"
"fmt"
"time"
"time"
"github.com/allegro/bigcache"
"github.com/allegro/bigcache"
)
)
var
bigcacheConfig
=
bigcache
.
Config
{
const
(
// number of shards (must be a power of 2)
BIGCACHEShards
=
8
// Shards: 4096,
BIGCACHEMaxEntrySize
=
1024
Shards
:
config
.
BIGCACHEShards
,
BIGCACHEVerbose
=
true
// time after which entry can be evicted
BIGCACHEHardMaxCacheSize
=
0
LifeWindow
:
config
.
BIGCACHELifeWindow
*
time
.
Hour
,
BIGCACHEMaxEntriesInWindow
=
1000
10
60
// rps * lifeWindow, used only in initial memory allocation
BIGCACHELifeWindow
=
2
MaxEntriesInWindow
:
1000
*
10
*
60
,
)
// MaxEntriesInWindow: 10,
var
bigcacheConfig
=
bigcache
.
Config
{
// max entry size in bytes, used only in initial memory allocation
// number of shards (must be a power of 2)
MaxEntrySize
:
config
.
BIGCACHEMaxEntrySize
,
// Shards: 4096,
// prints information about additional memory allocation
Shards
:
BIGCACHEShards
,
Verbose
:
config
.
BIGCACHEVerbose
,
// time after which entry can be evicted
// cache will not allocate more memory than this limit, value in MB
LifeWindow
:
BIGCACHELifeWindow
*
time
.
Hour
,
// if value is reached then the oldest entries can be overridden for the new ones
// rps * lifeWindow, used only in initial memory allocation
// 0 value means no size limit
MaxEntriesInWindow
:
1000
*
10
*
60
,
HardMaxCacheSize
:
config
.
BIGCACHEHardMaxCacheSize
,
// MaxEntriesInWindow: 10,
// callback fired when the oldest entry is removed because of its
// max entry size in bytes, used only in initial memory allocation
// expiration time or no space left for the new entry. Default value is nil which
MaxEntrySize
:
BIGCACHEMaxEntrySize
,
// means no callback and it prevents from unwrapping the oldest entry.
// prints information about additional memory allocation
OnRemove
:
nil
,
Verbose
:
BIGCACHEVerbose
,
}
// cache will not allocate more memory than this limit, value in MB
// if value is reached then the oldest entries can be overridden for the new ones
var
cache
,
initErr
=
bigcache
.
NewBigCache
(
bigcacheConfig
)
// 0 value means no size limit
HardMaxCacheSize
:
BIGCACHEHardMaxCacheSize
,
//GetValue GetValue
// callback fired when the oldest entry is removed because of its
func
GetValue
(
key
string
)
([]
byte
,
error
)
{
// expiration time or no space left for the new entry. Default value is nil which
return
cache
.
Get
(
key
)
// means no callback and it prevents from unwrapping the oldest entry.
}
OnRemove
:
nil
,
}
//SetValue SetValue
func
SetValue
(
key
string
,
value
[]
byte
)
{
var
cache
,
initErr
=
bigcache
.
NewBigCache
(
bigcacheConfig
)
cache
.
Set
(
key
,
value
)
}
//GetValue GetValue
func
GetValue
(
key
string
)
([]
byte
,
error
)
{
//GetLength GetLength
return
cache
.
Get
(
key
)
func
GetLength
()
int
{
}
return
cache
.
Len
()
}
//SetValue SetValue
func
SetValue
(
key
string
,
value
[]
byte
)
{
//Callback function executed when cache element is removed.
cache
.
Set
(
key
,
value
)
//Executed only when onRemove of cache config poting to this function
}
func
onRemove
(
key
string
,
entry
[]
byte
)
{
fmt
.
Println
(
key
+
" removed at "
+
time
.
Now
()
.
String
())
//GetLength GetLength
}
func
GetLength
()
int
{
return
cache
.
Len
()
}
//Callback function executed when cache element is removed.
//Executed only when onRemove of cache config poting to this function
func
onRemove
(
key
string
,
entry
[]
byte
)
{
fmt
.
Println
(
key
+
" removed at "
+
time
.
Now
()
.
String
())
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
configHelper.go
+
10
−
16
View file @
497ad486
package
coreos
package
coreos
import
(
"fmt"
"github.com/spf13/viper"
)
//InitViper function to initialize viper
//InitViper function to initialize viper
func
InitViper
()
{
func
InitViper
()
{
viper
.
SetConfigName
(
"config"
)
// name of config file (without extension)
//
viper.SetConfigName("config") // name of config file (without extension)
viper
.
AddConfigPath
(
"."
)
// optionally look for config in the working directory
//
viper.AddConfigPath(".") // optionally look for config in the working directory
err
:=
viper
.
ReadInConfig
()
//
err := viper.ReadInConfig()
// Find and read the config file
//
//
Find and read the config file
if
err
!=
nil
{
// Handle errors reading the config file
//
if err != nil { // Handle errors reading the config file
panic
(
fmt
.
Errorf
(
"Fatal error config file %s "
,
err
))
//
panic(fmt.Errorf("Fatal error config file %s ", err))
}
//
}
}
}
//GetConfig method to get configs from config file
//GetConfig method to get configs from config file
func
GetConfig
(
keyName
string
)
string
{
func
GetConfig
(
keyName
string
)
string
{
keyValue
:=
viper
.
GetString
(
keyName
)
// keyValue := viper.GetString(keyName)
return
keyValue
// return keyValue
return
""
}
}
This diff is collapsed.
Click to expand it.
DAL
MySQL.go
→
dal
MySQL.go
+
1
−
3
View file @
497ad486
...
@@ -3,8 +3,6 @@ package coreos
...
@@ -3,8 +3,6 @@ package coreos
import
(
import
(
"sync"
"sync"
"GolangFullStack/server/api/server/config"
"github.com/gocraft/dbr"
"github.com/gocraft/dbr"
)
)
...
@@ -16,7 +14,7 @@ var sqlOnce sync.Once
...
@@ -16,7 +14,7 @@ var sqlOnce sync.Once
func
GetSQLConnection
()
(
*
dbr
.
Connection
,
error
)
{
func
GetSQLConnection
()
(
*
dbr
.
Connection
,
error
)
{
sqlOnce
.
Do
(
func
()
{
sqlOnce
.
Do
(
func
()
{
// create a connection db(e.g. "postgres", "mysql", or "sqlite3")
// create a connection db(e.g. "postgres", "mysql", or "sqlite3")
connection
,
_
:=
dbr
.
Open
(
"mysql"
,
c
onfig
.
MysqlDSN
,
nil
)
connection
,
_
:=
dbr
.
Open
(
"mysql"
,
GetC
onfig
(
"
MysqlDSN
"
)
,
nil
)
// connection.SetMaxIdleConns(10)
// connection.SetMaxIdleConns(10)
// connection.SetMaxOpenConns(5)
// connection.SetMaxOpenConns(5)
...
...
This diff is collapsed.
Click to expand it.
DAL
NoSQL.go
→
dal
NoSQL.go
+
2
−
3
View file @
497ad486
package
coreos
package
coreos
import
(
import
(
"GolangFullStack/server/api/server/config"
"fmt"
"fmt"
"sync"
"sync"
...
@@ -15,12 +14,12 @@ var once sync.Once
...
@@ -15,12 +14,12 @@ var once sync.Once
func
GetMongoConnection
()
*
mgo
.
Session
{
func
GetMongoConnection
()
*
mgo
.
Session
{
once
.
Do
(
func
()
{
once
.
Do
(
func
()
{
Host
:=
[]
string
{
Host
:=
[]
string
{
c
onfig
.
MONGODSN
,
GetC
onfig
(
"
MONGODSN
"
)
,
}
}
const
(
const
(
Username
=
""
Username
=
""
Password
=
""
Password
=
""
Database
=
c
onfig
.
DBNAME
Database
=
GetC
onfig
(
"
DBNAME
"
)
)
)
session
,
err
:=
mgo
.
DialWithInfo
(
&
mgo
.
DialInfo
{
session
,
err
:=
mgo
.
DialWithInfo
(
&
mgo
.
DialInfo
{
...
...
This diff is collapsed.
Click to expand it.
DAL
Redis.go
→
dal
Redis.go
+
1
−
3
View file @
497ad486
package
coreos
package
coreos
import
(
import
(
"GolangFullStack/server/api/server/config"
"github.com/garyburd/redigo/redis"
"github.com/garyburd/redigo/redis"
)
)
...
@@ -13,7 +11,7 @@ func GetWorkPool() *redis.Pool {
...
@@ -13,7 +11,7 @@ func GetWorkPool() *redis.Pool {
MaxIdle
:
5
,
MaxIdle
:
5
,
Wait
:
true
,
Wait
:
true
,
Dial
:
func
()
(
redis
.
Conn
,
error
)
{
Dial
:
func
()
(
redis
.
Conn
,
error
)
{
return
redis
.
Dial
(
"tcp"
,
c
onfig
.
REDISDSN
,
redis
.
DialDatabase
(
3
))
return
redis
.
Dial
(
"tcp"
,
GetC
onfig
(
"
REDISDSN
"
)
,
redis
.
DialDatabase
(
3
))
},
},
}
}
return
redisPool
return
redisPool
...
...
This diff is collapsed.
Click to expand it.
D
ataConvertor.go
→
d
ataConvertor.go
+
0
−
0
View file @
497ad486
File moved
This diff is collapsed.
Click to expand it.
E
choHelper.go
→
e
choHelper.go
+
0
−
0
View file @
497ad486
File moved
This diff is collapsed.
Click to expand it.
glide.yaml
+
2
−
1
View file @
497ad486
package
:
coreospackage
package
:
coreospackage
import
:
import
:
-
package
:
GolangFullStack/server/api/server/config
-
package
:
github.com/allegro/bigcache
-
package
:
github.com/allegro/bigcache
-
package
:
github.com/dgrijalva/jwt-go
-
package
:
github.com/dgrijalva/jwt-go
version
:
^3.0.0
version
:
^3.0.0
...
@@ -16,7 +17,7 @@ import:
...
@@ -16,7 +17,7 @@ import:
-
package
:
github.com/gocraft/dbr
-
package
:
github.com/gocraft/dbr
version
:
^2.1.0
version
:
^2.1.0
-
package
:
github.com/labstack/echo
-
package
:
github.com/labstack/echo
version
:
^3.2.
0
version
:
^3.2.
1
subpackages
:
subpackages
:
-
middleware
-
middleware
-
package
:
github.com/sirupsen/logrus
-
package
:
github.com/sirupsen/logrus
...
...
This diff is collapsed.
Click to expand it.
loggingHelper.go
+
1
−
1
View file @
497ad486
...
@@ -42,7 +42,7 @@ func Error(message string) {
...
@@ -42,7 +42,7 @@ func Error(message string) {
logger
.
Error
(
message
)
logger
.
Error
(
message
)
}
}
//Panic Panic
//Panic Panic
func
Panic
(
message
string
)
{
func
Panic
(
message
string
)
{
logger
.
Panic
(
message
)
logger
.
Panic
(
message
)
}
}
This diff is collapsed.
Click to expand it.
smsHelper.go
+
1
−
2
View file @
497ad486
package
coreos
package
coreos
import
(
import
(
"GolangFullStack/server/api/server/config"
"fmt"
"fmt"
"io/ioutil"
"io/ioutil"
"log"
"log"
...
@@ -21,7 +20,7 @@ type SMS struct {
...
@@ -21,7 +20,7 @@ type SMS struct {
// SendSMS : send SMS Service
// SendSMS : send SMS Service
func
SendSMS
(
smsObject
SMS
)
error
{
func
SendSMS
(
smsObject
SMS
)
error
{
var
postURL
string
var
postURL
string
postURL
=
c
onfig
.
SMSAPIURL
+
"?UserName="
+
smsObject
.
UserName
+
"&password="
+
smsObject
.
Password
+
"&MobileNo="
+
smsObject
.
MobileNumber
+
"&SenderID="
+
smsObject
.
SenderID
+
"&CDMAHeader="
+
smsObject
.
CDMAHeader
+
"&Message="
+
url
.
QueryEscape
(
smsObject
.
Message
)
postURL
=
GetC
onfig
(
"
SMSAPIURL
"
)
+
"?UserName="
+
smsObject
.
UserName
+
"&password="
+
smsObject
.
Password
+
"&MobileNo="
+
smsObject
.
MobileNumber
+
"&SenderID="
+
smsObject
.
SenderID
+
"&CDMAHeader="
+
smsObject
.
CDMAHeader
+
"&Message="
+
url
.
QueryEscape
(
smsObject
.
Message
)
// fmt.Println(postURL)
// fmt.Println(postURL)
resp
,
err
:=
http
.
Get
(
postURL
)
resp
,
err
:=
http
.
Get
(
postURL
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
validationHelper.go
+
1
−
2
View file @
497ad486
...
@@ -2,7 +2,6 @@ package coreos
...
@@ -2,7 +2,6 @@ package coreos
import
(
import
(
"github.com/go-playground/locales/en"
"github.com/go-playground/locales/en"
"gopkg.in/go-playground/validator.v9"
ut
"github.com/go-playground/universal-translator"
ut
"github.com/go-playground/universal-translator"
en_translations
"gopkg.in/go-playground/validator.v9/translations/en"
en_translations
"gopkg.in/go-playground/validator.v9/translations/en"
...
@@ -46,7 +45,7 @@ func Validate(s interface{}) map[string]string {
...
@@ -46,7 +45,7 @@ func Validate(s interface{}) map[string]string {
for
_
,
e
:=
range
errs
{
for
_
,
e
:=
range
errs
{
// can translate each error one at a time.
// can translate each error one at a time.
customErrs
[
e
.
Namespace
()]
=
e
.
Translate
(
trans
)
customErrs
[
e
.
Namespace
()]
=
e
.
Translate
(
trans
)
}
}
return
customErrs
return
customErrs
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets