Skip to content

Latest commit

 

History

History
15 lines (11 loc) · 783 Bytes

README.md

File metadata and controls

15 lines (11 loc) · 783 Bytes

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",
)