liteutil

package
v0.0.0-...-692e47d Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: MIT Imports: 2 Imported by: 2

Documentation

Overview

The liteutil package implements utility functions around mattn's go-sqlite3 package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrorConstraintUnique

func IsErrorConstraintUnique(err error) bool

IsErrorConstraintUnique will return true for either ErrConstraintUnique or ErrConstraintPrimaryKey.

func IsErrorForeignKey

func IsErrorForeignKey(err error) bool

IsErrorForeignKey will return true for ErrConstraintForeignKey

func IsSqliteErrorCode

func IsSqliteErrorCode(err error, queries ...error) bool

sqlite3 error code definitiions are somewhat difficult to use: You can't simply compare the Err* constants to the resulting value, because they're of different types.

IsSqliteErrorCode will take an error and a range of "query errors" (which must be of type sqlite3.ErrNo or sqlite3.ErrNoExtended) and check for matches. (Values not of these types will be skipped.)

For example, the following will check to see if `err` is (or contains) ErrBusy or ErrLocked:

IsSqliteErrorCode(err, sqlite3.ErrBusy, sqlite3.ErrLocked)

Types

This section is empty.

Jump to

Keyboard shortcuts

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