the full name is cloud application runtime interface, it defines the interfaces of cloud services that application should follow to run in cloud
defines a common struct to store kv configuration
defines a standard service for register and discovery, service like eureka,consul and service center
defines a common interface to encrypt and decrypt info
defines a common struct to account and role info
defines a config struct to connect db, contains two connection methods of db (etcd and mongo)
how to use it
- First you should import the bootstrap package
import (
_ "github.com/go-chassis/cari/db/bootstrap"
)
- The second initialization db selects etcd or mongo
// etcd
cfg:=config.Config{
Kind: "mongo",
URI: "mongodb://127.0.0.1:27017",
Timeout: 10 * time.Second,
}
// or mongo
cfg:=config.Config{
Kind: "mongo",
URI: "mongodb://127.0.0.1:27017",
Timeout: 10 * time.Second,
}
err = db.Init(&cfg)
- Using etcd client
etcdadpt.Put()
- Using mongo client
mongo.GetClient().GetDB()
defines common structs for synchronization mechanism, synchronize data to different peer clusters
dlock provide distributed lock function
how to use it
-
First you should initialize db
-
Second import dlock bootstrap package
import (
_ "github.com/go-chassis/cari/dlock/bootstrap"
)
- Init dlock
dlock.Init(dlock.Options{Kind: "etcd")