db

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxLenForName     = 64
	MaxLenForEmail    = 160
	MaxLenForShortURL = 256
)

Max values for strings

Variables

This section is empty.

Functions

func ID

func ID(id string) (uint64, error)

ID returns id from the string

func IDString

func IDString(id uint64) string

IDString returns string id

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError returns true, if error is NotFound

func Migrate

func Migrate(migrationsDir string, forceVersion int, db *sql.DB) error

Migrate performs the db migration

func NullTime

func NullTime(val *time.Time) sql.NullTime

NullTime from *time.Time

func String

func String(val *string) string

String returns string

func Validate

func Validate(m interface{}) error

Validate returns error if the model is not valid

Types

type IDGenerator

type IDGenerator interface {
	// NextID generates a next unique ID.
	NextID() (uint64, error)
}

IDGenerator defines an interface to generate unique ID accross the cluster

type Validator

type Validator interface {
	// Validate returns error if the model is not valid
	Validate() error
}

Validator provides schema validation interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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