Skip to content

ahmettek/vtec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • Locally:
go run cmd/api/main.go  
  • Docker:
docker build --tag vtec .   
docker run -p 5005:80 vtec
  • End Points:
[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!

  • Create Api:
api :=gopi.New()
  • Add End Point:
api.GET("/api/values/:id",func (g*GopiContext){})
api.POST("/api/values",func (g*GopiContext){})
api.DELETE("/api/values/",func (g*GopiContext){})
  • Handle Params:
func (v * ValuesHandler)  Get(gc * gopi.GopiContext) {
    id:= gc.Param[":id"]
}
  • Run:
 api.Listen("80")

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published