sqltime

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package sqltime provides support for Postgres time data type.

Index

Constants

This section is empty.

Variables

View Source
var ErrTooManyParts = errors.New("too many parts")

Functions

This section is empty.

Types

type AtoiError added in v0.2.0

type AtoiError struct {
	Part Part
	Err  error
}

func (*AtoiError) Error added in v0.2.0

func (e *AtoiError) Error() string

func (*AtoiError) Unwrap added in v0.2.0

func (e *AtoiError) Unwrap() error

type Part added in v0.2.0

type Part int

Part indicates a part of time (e.g. hour).

const (
	PartHour Part = iota + 1
	PartMinute
	PartSecond
)

func (Part) String added in v0.2.0

func (p Part) String() string

type RangeError added in v0.2.0

type RangeError struct {
	Part Part
	Min  int
	Max  int
}

func (*RangeError) Error added in v0.2.0

func (e *RangeError) Error() string

type Time

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

Time is a one-to-one representation of SQL time data type.

func Parse added in v0.2.0

func Parse(s string) (Time, error)

Parse parses a formatted string, in time.TimeOnly (15:04:05) format, and returns the time value it represents.

func (Time) Add added in v0.2.0

func (t Time) Add(d Time) Time

Add returns the time t+d.

func (Time) Hour

func (t Time) Hour() int

Hour returns the hour specified by t, in the range [0, 23].

func (Time) MarshalJSON

func (s Time) MarshalJSON() ([]byte, error)

func (Time) Minute

func (t Time) Minute() int

Minute returns the minute specified by t, in the range [0, 59].

func (*Time) Parse

func (t *Time) Parse(s string) error

Parse parses a formatted string, in time.TimeOnly (15:04:05) format.

func (*Time) Scan

func (s *Time) Scan(src any) error

func (Time) Second

func (t Time) Second() int

Second returns the second specified by t, in the range [0, 59].

func (Time) String

func (t Time) String() string

func (Time) Sub added in v0.2.0

func (t Time) Sub(d Time) Time

Sub returns the time t-d.

func (*Time) UnmarshalJSON

func (s *Time) UnmarshalJSON(data []byte) error

func (Time) Value

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

Jump to

Keyboard shortcuts

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