types

package
v0.0.0-...-60192f8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package types provides some shared database types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONBytes

func JSONBytes(value any) ([]byte, error)

JSONBytes converts a string or a []uint8 to a []byte value. We need this with sqlite and postgresql not returning the same data type for their json fields.

Types

type Strings

type Strings []string

Strings is a list of strings stored in a column.

func (*Strings) Scan

func (s *Strings) Scan(value any) error

Scan loads a Strings instance from a column.

func (Strings) Value

func (s Strings) Value() (driver.Value, error)

Value encodes a Strings instance for storage.

type TimeString

type TimeString time.Time

TimeString is a time.Time with a special scanner. We need this type when we extract time values from a json field. Postgresql recognizes a time.Time just fine but not sqlite.

func (*TimeString) Scan

func (t *TimeString) Scan(value any) error

Scan loads the TimeString instance from a given column.

Jump to

Keyboard shortcuts

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