Example #1
0
func main() {
	client := dbdb.NewClient()
	if ok := client.Connect("127.0.0.1:31337", auth); !ok {
		log.Fatal("error connecting to host...")
	}
	if ok := client.HasStore("foobar"); !ok {
		client.AddStore("foobar")
	}
	client.Add("foobar", map[string]interface{}{
		"id":     1,
		"name":   []string{"Scott", "Cagno"},
		"email":  "*****@*****.**",
		"age":    28,
		"active": true,
	})
	client.Disconnect()
}
Example #2
0
	"log"
	"net/http"
	"os"
	"runtime"
	"sort"
	"strconv"
	"strings"
	"time"

	"github.com/cagnosolutions/dbdb"
	"github.com/cagnosolutions/mockdb"
	"github.com/cagnosolutions/webc"
	"github.com/cagnosolutions/webc/tmpl"
)

var rpc = dbdb.NewClient()
var ts = tmpl.NewTemplateStore(true)
var config = mockdb.NewMockDB("config.json", 5)

func main() {
	mux := webc.NewMux("CTIXID", (webc.HOUR / 2))

	// db managment
	mux.Get("/test", Test)
	mux.Get("/", Root)
	mux.Post("/connection", AddConnection)
	mux.Post("/connection/save", SaveConnection)
	mux.Post("/connection/:db/del", DelConnection)

	mux.Get("/connect/:db", Connect)
	mux.Get("/disconnect", Disconnect)