timestamp

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NegativeInfinityTS = time.Date(math.MinInt32, time.January, 1, 0, 0, 0, 0, time.UTC)
	PositiveInfinityTS = time.Date(math.MaxInt32, time.December, 31, 23, 59, 59, 1e9-1, time.UTC)
)
View Source
var File_resources_timestamp_timestamp_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Timestamp

type Timestamp struct {
	Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// contains filtered or unexported fields
}

Timestamp for storage messages. We've defined a new local type wrapper of google.protobuf.Timestamp so we can implement sql.Scanner and sql.Valuer interfaces. See: https://golang.org/pkg/database/sql/#Scanner https://golang.org/pkg/database/sql/driver/#Valuer

func New

func New(t time.Time) *Timestamp

New constructs a new Timestamp from the provided time.Time.

func Now

func Now() *Timestamp

Now constructs a new Timestamp from the current time.

func (*Timestamp) AsTime

func (x *Timestamp) AsTime() time.Time

AsTime converts x to a time.Time.

func (*Timestamp) Descriptor deprecated

func (*Timestamp) Descriptor() ([]byte, []int)

Deprecated: Use Timestamp.ProtoReflect.Descriptor instead.

func (*Timestamp) GetTimestamp

func (x *Timestamp) GetTimestamp() *timestamppb.Timestamp

func (*Timestamp) ProtoMessage

func (*Timestamp) ProtoMessage()

func (*Timestamp) ProtoReflect

func (x *Timestamp) ProtoReflect() protoreflect.Message

func (*Timestamp) Reset

func (x *Timestamp) Reset()

func (*Timestamp) Scan

func (ts *Timestamp) Scan(value any) error

Scan implements sql.Scanner for protobuf Timestamp.

func (*Timestamp) String

func (x *Timestamp) String() string

func (*Timestamp) Validate

func (m *Timestamp) Validate() error

Validate checks the field values on Timestamp with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Timestamp) ValidateAll

func (m *Timestamp) ValidateAll() error

ValidateAll checks the field values on Timestamp with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in TimestampMultiError, or nil if none found.

func (*Timestamp) Value

func (ts *Timestamp) Value() (driver.Value, error)

Value marshals the value into driver.Valuer.

type TimestampMultiError

type TimestampMultiError []error

TimestampMultiError is an error wrapping multiple validation errors returned by Timestamp.ValidateAll() if the designated constraints aren't met.

func (TimestampMultiError) AllErrors

func (m TimestampMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (TimestampMultiError) Error

func (m TimestampMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type TimestampValidationError

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

TimestampValidationError is the validation error returned by Timestamp.Validate if the designated constraints aren't met.

func (TimestampValidationError) Cause

func (e TimestampValidationError) Cause() error

Cause function returns cause value.

func (TimestampValidationError) Error

func (e TimestampValidationError) Error() string

Error satisfies the builtin error interface

func (TimestampValidationError) ErrorName

func (e TimestampValidationError) ErrorName() string

ErrorName returns error name.

func (TimestampValidationError) Field

func (e TimestampValidationError) Field() string

Field function returns field value.

func (TimestampValidationError) Key

Key function returns key value.

func (TimestampValidationError) Reason

func (e TimestampValidationError) Reason() string

Reason function returns reason value.

Jump to

Keyboard shortcuts

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