constructor-badger - Constructor wrapper for badger
![GoDoc](https://godoc.org/github.com/stackopsd/constructor-badger?status.svg)
Quick Start
package main
import (
"context"
"google.golang.org/grpc"
"github.com/stackopsd/config"
"github.com/stackopsd/constructor"
cbadger "github.com/stackopsd/constructor-badger"
)
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
cons := cbadger.NewConstructor()
db := new(badger.DB)
// Create a loader from a source of configuration data.
loader := config.NewFileLoader("/path/to/some/config.json_or_yaml")
if err := constructor.New(ctx, loader, &cons, db); err != nil {
panic(err)
}
defer db.Close()
go func(){
_ = srv.Serve(srv.Listener)
}()
if err := constructor.New(ctx, loader, &clientConst, clientConn); err != nil {
panic(err)
}
defer db.Close()
}
Example Configuration
If loading from a file, the following represents all the possible options:
path: "/path/to/db"
License
Copyright 2019 Kevin Conway
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.