storz is an object store framework built in golang. It consists of a set of modules implementing the Store interface and features a simple object modeling language used to generate golang object class meta for interacting with Store
APIs.
storz modules provide functionality to store, modify and retrieve modeled objects from various sources. Such modules can be composed together to chain Store
functionality into more complex logical modules. Combining modules allows handling object changes and manipulating data in complex ways within or across services, making multi-level server complexity achievable with ease. The modules are fully compatible with each other and can be composed in any combination since they all implement or expose the same Store interface.
Quick Start Guide
Installation
go get github.com/wazofski/gostorz
go install github.com/wazofski/gostorz
Project Creation
Create a storz project containing go module, sample model and main.go source file.
storz init [project]
cd [project]
Generate storz class meta using project model YAML files
go generate
Build and Execute
go build
./[project]
or
go run cmd/main.go
Features
Persistence Layer
Persistence modules are independent, meaning they do not need another Store to operate.
- Memory store - simple in-memory store useful for temporary storage cases
- Mongo store - uses an existing Mongo DB to store Objects
- SQL store - uses a SQL database connection for storage
Functional Layer
Functional modules require existing Stores to operate.
These modules are meant to enhance the functionality of an existing store by composing itself with another Store.
A caching layer can be added to a Store and then wrapped into another layer of React that adds validation logic to object changes.
- Cache store - simple caching mechanism using an existing Store
- Route store - mapping between types and Stores is used to route requests
- React store - react to object changes before they get submitted
REST
Utility
Module Composition Example
- Frontend service
- Cached store based on
- Rest client connected to the backend service
- Backend service
- Rest server exposing
- React store running validations and other logic on top of
- Router store which routes
- Coke objects to a cached store based on
- SQL store (in another network)
- Pepsi objects to
- Fanta objects to a cached
- REST client store connected to another service
- Second backend service
- Rest server exposing
- React store running validations and other logic on top of