pgsql

package module
v0.0.0-...-2a72b3c Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

README

go-locks/distlockPostgres 驱动。客户端使用 lib/pq 实现。本驱动支持互斥锁 mutex 和读写锁 rwmutex。更多使用案例详见 examples

代码实例

使用前需创建一个 dbname,然后导入 structure.sql

var pgDriver = New(
	"host=192.168.0.110 port=5432 user=postgres password= dbname=gotest sslmode=disable",
	// 可继续指定其他节点,当有多个节点时,在过半数节点上加锁成功才算真的成功
	// "host=192.168.0.111 port=5432 user=postgres password= dbname=gotest sslmode=disable",
	// "host=192.168.0.112 port=5432 user=postgres password= dbname=gotest sslmode=disable",
)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MaxReaders            = 1 << 30
	MinWatchRetryInterval = time.Millisecond
	MaxWatchRetryInterval = time.Second * 16
)

Functions

func New

func New(dsn ...string) *pgsqlDriver

Types

This section is empty.

Jump to

Keyboard shortcuts

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