pubsubsql / client

Go client for PubSubSQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

Introduction

This is Go client for PubSubSQL, an in-memory database with SQL-like syntax and usage but offering PUB-SUB functionality and MySQL as secondary datastore. Supported versions of Go are 1.3 and up.

Example

package main

import (
	"fmt"

	"github.com/pubsubsql/client"
)

func checkError(client *pubsubsql.Client, str string) {
	if client.Failed() {
		fmt.Println("Error:", client.Error(), str)
		os.Exit(1)
	}
}

func main() {
	client := new(pubsubsql.Client)

	address := "localhost:7777"
	client.Connect(address)
	checkError(client, "client connect failed")

	filepath := "/bin/ls"

	mimetype, err := mm.TypeByFile(filepath)
	if err != nil {
		fmt.Printf("Something went wrong: %s", err)
		return
	}

	fmt.Printf("%s -> %s\n", filepath, mimetype)
}

About

Go client for PubSubSQL

License:Apache License 2.0


Languages

Language:Go 100.0%