https://github.com/quangdangfit/gosdk
Software Development Kit for Golang
https://github.com/quangdangfit/gosdk
common-library golang sdk-go
Last synced: about 1 year ago
JSON representation
Software Development Kit for Golang
- Host: GitHub
- URL: https://github.com/quangdangfit/gosdk
- Owner: quangdangfit
- Created: 2020-07-20T03:14:54.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-09T09:47:13.000Z (almost 6 years ago)
- Last Synced: 2025-02-17T12:45:24.164Z (over 1 year ago)
- Topics: common-library, golang, sdk-go
- Language: Go
- Homepage:
- Size: 130 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Go development toolkit
**Common lib in golang (datbase wrapper, logger, ...)**
- Managed by version: [What is the version ?
](https://semver.org/)
- Please `note here` what changes in each version
###Logger:
Call in first line of main func:
```go
package main
import (
...
"github.com/quangdangfit/gosdk/utils/logger"
)
func main(){
logger.Initialize(config.Config.Production)
...
}
```
###Mgo wrapper:
```go
package main
import (
...
"gopkg.in/mgo.v2/bson"
db "github.com/quangdangfit/gosdk/database"
)
func main(){
dbConfig := db.DBConfig{
Hosts: "localhost:27017",
AuthDatabase: "admin",
AuthUserName: "",
AuthPassword: "",
Database: "testdb",
}
db := db.Connect(dbConfig)
//Define model
type Brand struct {
Code string `json:"code" bson:"code"`
Name string `json:"name" bson:"name"`
}
var results = []Brand{}
collectionName := "brand"
filter := bson.M{"code": "code"}
err = db.FindMany(collectionName, filter, "_id", &results)
if err != nil {
...
}
}
```