Help us shape the future of Go! Take the 2026 Go Developer Survey

nosql

package
v3.1.61 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToLevelDBURI

func ToLevelDBURI(connection string) *url.URL

ToLevelDBURI converts old style connections to a LevelDBURI

A LevelDBURI matches the pattern:

leveldb://path[?[option=value]*]

We have previously just provided the path but this prevent other options

func ToRedisURI

func ToRedisURI(connection string) *url.URL

ToRedisURI converts old style connections to a RedisURI

A RedisURI matches the pattern:

redis://[username:password@]host[:port][/database][?[option=value]*] rediss://[username:password@]host[:port][/database][?[option=value]*] redis+socket://[username:password@]path[/database][?[option=value]*] redis+sentinel://[password@]host1 [: port1][, host2 [:port2]][, hostN [:portN]][/ database][?[option=value]*] redis+cluster://[password@]host1 [: port1][, host2 [:port2]][, hostN [:portN]][/ database][?[option=value]*]

We have previously used a URI like: addrs=127.0.0.1:6379 db=0 network=tcp,addr=127.0.0.1:6379,password=macaron,db=0,pool_size=100,idle_timeout=180

We need to convert this old style to the new style

Types

type Manager

type Manager struct {
	RedisConnections   map[string]*redisClientHolder
	LevelDBConnections map[string]*levelDBHolder
	// contains filtered or unexported fields
}

Manager is the nosql connection manager

func GetManager

func GetManager() *Manager

GetManager returns a Manager and initializes one as singleton is there's none yet

func (*Manager) CloseLevelDB

func (m *Manager) CloseLevelDB(connection string) error

CloseLevelDB closes a levelDB

func (*Manager) CloseRedisClient

func (m *Manager) CloseRedisClient(connection string) error

CloseRedisClient closes a redis client

func (*Manager) GetLevelDB

func (m *Manager) GetLevelDB(connection string) (db *leveldb.DB, err error)

GetLevelDB gets a levelDB for a particular connection

func (*Manager) GetRedisClient

func (m *Manager) GetRedisClient(connection string) (client redis.UniversalClient)

GetRedisClient gets a redis client for a particular connection

Source Files

  • leveldb.go
  • manager.go
  • manager_leveldb.go
  • manager_redis.go
  • redis.go

Jump to

Keyboard shortcuts

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