vtec
vtec, is a simple in-memory key-value store application.
vtec provides persistence by appending transactions to a json file and restoring data from the json file on startup.
vtec is designed with simplicity as the main purpose and has zero external dependencies.
VTEC Key-Value Store
To start using vtec, install Go and run go get:
$ go get -u github.com/ahmettek/vtec
App Usage
go run cmd/api/main.go
docker build --tag vtec .
docker run -p 5005:80 vtec
[POST] http://localhost:5005/api/values
{
"Key": "test",
"Value":"value"
}
[GET] http://localhost:5005/api/values/:key
[DELETE] http://localhost:5005/api/values
OR
Postman Collection: https://raw.githubusercontent.com/ahmettek/vtec/main/static/endpoints.postman_collection.json
Package Usage
Vtec Key-Value Store
Create a store, add key and play with it.
v := vtec.New(vtec.Options{
SyncInternal: 10000, //ms
Storage: &storage.FileStore{
FileName: "keyvalue-store.json",
},
})
v.Set("my_string", "Hello World!");
value := v.Get("my_string")
fmt.Println(value) // Hello World!
Gopi Basic http Handler Wrapper
Create a api, add end point and serve!
api :=gopi.New()
api.GET("/api/values/:id",func (g*GopiContext){})
api.POST("/api/values",func (g*GopiContext){})
api.DELETE("/api/values/",func (g*GopiContext){})
func (v * ValuesHandler) Get(gc * gopi.GopiContext) {
id:= gc.Param[":id"]
}
api.Listen("80")