psql

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: ISC Imports: 5 Imported by: 1

Documentation

Overview

Package sqldb interfaces database/sql

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelFromContext

func DelFromContext(ctx context.Context, key string) (ok bool)

DelFromContext removes a value from context. Thread-safe

func DiscardDB

func DiscardDB(ctx context.Context)

DiscardDB removes db handle from context

func GetDB

func GetDB(ctx context.Context) (db *sql.DB)

GetDB obtains db handle from context

func StoreDB

func StoreDB(ctx context.Context, db *sql.DB)

StoreDB saves db handle in context

func StoreInContext

func StoreInContext(ctx context.Context, key string, value interface{}) (ok bool)

StoreInContext stores a value in context. Thread-safe

Types

type Context

type Context struct {
	context.Context
	Map sync.Map
}

Context is a context.Context with a Value() implementation

func NewContext

func NewContext(ctx ...context.Context) (c *Context)

NewContext provides a context.Context with a Value() implementation

func (*Context) Delete

func (c *Context) Delete(key string)

StoreInContext stores a value in context. Thread-safe

func (*Context) Store

func (c *Context) Store(key string, value interface{})

StoreInContext stores a value in context. Thread-safe

func (*Context) Value

func (c *Context) Value(key interface{}) (result interface{})

Value retrieves data from context. Thread-safe

func (*Context) Value2

func (c *Context) Value2(key interface{}) (result interface{}, ok bool)

Value2 retrieves data and was–present indicator from context. Thread-safe

type Result

type Result struct {
	sql.Result
}

Result makes sql.Result printable

func (*Result) Get

func (r *Result) Get() (id int64, count int64, sErr string, err error)

Get obtains last id and number of affected rows

func (Result) String

func (r Result) String() (s string)

Jump to

Keyboard shortcuts

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