Version: v0.0.0-...-105474d Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2020 License: MIT Imports: 6 Imported by: 0




View Source
const (
	MYSQL_DRIVER       = "mysql"
	NONE         int64 = 0
View Source
const ETCD_TIMEOUT = 3


This section is empty.


func EtcdDelete

func EtcdDelete(clt *clientv3.Client, keyString string) (bool, error)

Delete a key

func EtcdDeletePrefix

func EtcdDeletePrefix(clt *clientv3.Client, prefixString string) (bool, error)

Delelte all keys with prefix

func EtcdGet

func EtcdGet(clt *clientv3.Client, keyString string) (string, error)

Get value of a key

func EtcdGetKeysOnly

func EtcdGetKeysOnly(clt *clientv3.Client, prefixString string) ([]string, error)

Get all keys with prefix

func EtcdGetPrefix

func EtcdGetPrefix(clt *clientv3.Client, prefixString string) ([]map[string]string, error)

Get values of all keys with prefix

func EtcdPut

func EtcdPut(clt *clientv3.Client, keyString string, valueString string) (bool, error)

Put value to a key

func EtcdPutWithLeast

func EtcdPutWithLeast(clt *clientv3.Client, keyString string, valueString string, t int64) (bool, error)

Put value to a key with TTL

func EtcdWatchOnce

func EtcdWatchOnce(clt *clientv3.Client, keyString string) (string, string, string)

Watch a key once

func EtcdWatchPrefixOnce

func EtcdWatchPrefixOnce(clt *clientv3.Client, prefixString string) (string, string, string)

Watch all keys with prefix

func MysqlExecuteDb

func MysqlExecuteDb(tdb *sql.DB, sqlString string, args ...interface{}) (bool, error)

Write to db, return number of rows

func MysqlQueryDb

func MysqlQueryDb(tdb *sql.DB, sqlString string, args ...interface{}) ([]map[string]string, error)

Read from db, return data


type EtcdConn

type EtcdConn struct {
	Host string
	Port int

func (*EtcdConn) Conn

func (c *EtcdConn) Conn() (*clientv3.Client, error)

type MysqlConn

type MysqlConn struct {
	Host    string
	Port    int
	User    string
	Pwd     string
	Db      string
	MaxOpen int
	MaxIdle int

func (*MysqlConn) Conn

func (c *MysqlConn) Conn() (*sql.DB, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL