postgres

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(connURL string) (drivers.Driver, error)

func WithInstance

func WithInstance(dbInstance *sql.DB, config *Config) (drivers.Driver, error)

Types

type Config

type Config struct {
	drivers.Config
	// contains filtered or unexported fields
}

type Mutex

type Mutex struct {
	// contains filtered or unexported fields
}

Mutex is similar to sync.Mutex, except usable by morph to lock the db.

Pick a unique name for each mutex your plugin requires.

A Mutex must not be copied after first use.

func NewMutex

func NewMutex(key string, driver drivers.Driver) (*Mutex, error)

NewMutex creates a mutex with the given key name.

returns error if key is empty.

func (*Mutex) Lock

func (m *Mutex) Lock()

Lock locks m. If the mutex is already locked by any other morph instance, including the current one, the calling goroutine blocks until the mutex can be locked.

func (*Mutex) LockWithContext

func (m *Mutex) LockWithContext(ctx context.Context) error

LockWithContext locks m unless the context is canceled. If the mutex is already locked by any other instance, including the current one, the calling goroutine blocks until the mutex can be locked, or the context is canceled.

The mutex is locked only if a nil error is returned.

func (*Mutex) Unlock

func (m *Mutex) Unlock()

Unlock unlocks m. It is a run-time error if m is not locked on entry to Unlock.

Just like sync.Mutex, a locked Lock is not associated with a particular goroutine or a process.

Jump to

Keyboard shortcuts

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