time

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_proto_time_proto protoreflect.FileDescriptor

Functions

func NewTimeEndpoints

func NewTimeEndpoints() []*api.Endpoint

func RegisterTimeHandler

func RegisterTimeHandler(s server.Server, hdlr TimeHandler, opts ...server.HandlerOption) error

Types

type NowRequest

type NowRequest struct {

	// optional location, otherwise returns UTC
	Location string `protobuf:"bytes,1,opt,name=location,proto3" json:"location,omitempty"`
	// contains filtered or unexported fields
}

Get the current time

func (*NowRequest) Descriptor deprecated

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

Deprecated: Use NowRequest.ProtoReflect.Descriptor instead.

func (*NowRequest) GetLocation

func (x *NowRequest) GetLocation() string

func (*NowRequest) ProtoMessage

func (*NowRequest) ProtoMessage()

func (*NowRequest) ProtoReflect

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

func (*NowRequest) Reset

func (x *NowRequest) Reset()

func (*NowRequest) String

func (x *NowRequest) String() string

type NowResponse

type NowResponse struct {

	// the current time as HH:MM:SS
	Localtime string `protobuf:"bytes,1,opt,name=localtime,proto3" json:"localtime,omitempty"`
	// timestamp as 2006-01-02T15:04:05.999999999Z07:00
	Timestamp string `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// the location as Europe/London
	Location string `protobuf:"bytes,3,opt,name=location,proto3" json:"location,omitempty"`
	// the timezone as BST
	Timezone string `protobuf:"bytes,4,opt,name=timezone,proto3" json:"timezone,omitempty"`
	// the unix timestamp
	Unix int64 `protobuf:"varint,5,opt,name=unix,proto3" json:"unix,omitempty"`
	// contains filtered or unexported fields
}

func (*NowResponse) Descriptor deprecated

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

Deprecated: Use NowResponse.ProtoReflect.Descriptor instead.

func (*NowResponse) GetLocaltime

func (x *NowResponse) GetLocaltime() string

func (*NowResponse) GetLocation

func (x *NowResponse) GetLocation() string

func (*NowResponse) GetTimestamp

func (x *NowResponse) GetTimestamp() string

func (*NowResponse) GetTimezone

func (x *NowResponse) GetTimezone() string

func (*NowResponse) GetUnix

func (x *NowResponse) GetUnix() int64

func (*NowResponse) ProtoMessage

func (*NowResponse) ProtoMessage()

func (*NowResponse) ProtoReflect

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

func (*NowResponse) Reset

func (x *NowResponse) Reset()

func (*NowResponse) String

func (x *NowResponse) String() string

type TimeHandler

type TimeHandler interface {
	Now(context.Context, *NowRequest, *NowResponse) error
	Zone(context.Context, *ZoneRequest, *ZoneResponse) error
}

type TimeService

type TimeService interface {
	Now(ctx context.Context, in *NowRequest, opts ...client.CallOption) (*NowResponse, error)
	Zone(ctx context.Context, in *ZoneRequest, opts ...client.CallOption) (*ZoneResponse, error)
}

func NewTimeService

func NewTimeService(name string, c client.Client) TimeService

type ZoneRequest

type ZoneRequest struct {

	// location to lookup e.g postcode, city, ip address
	Location string `protobuf:"bytes,1,opt,name=location,proto3" json:"location,omitempty"`
	// contains filtered or unexported fields
}

Get the timezone info for a specific location

func (*ZoneRequest) Descriptor deprecated

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

Deprecated: Use ZoneRequest.ProtoReflect.Descriptor instead.

func (*ZoneRequest) GetLocation

func (x *ZoneRequest) GetLocation() string

func (*ZoneRequest) ProtoMessage

func (*ZoneRequest) ProtoMessage()

func (*ZoneRequest) ProtoReflect

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

func (*ZoneRequest) Reset

func (x *ZoneRequest) Reset()

func (*ZoneRequest) String

func (x *ZoneRequest) String() string

type ZoneResponse

type ZoneResponse struct {

	// location requested
	Location string `protobuf:"bytes,1,opt,name=location,proto3" json:"location,omitempty"`
	// region of timezone
	Region string `protobuf:"bytes,2,opt,name=region,proto3" json:"region,omitempty"`
	// country of the timezone
	Country string `protobuf:"bytes,3,opt,name=country,proto3" json:"country,omitempty"`
	// e.g 51.42
	Latitude float64 `protobuf:"fixed64,4,opt,name=latitude,proto3" json:"latitude,omitempty"`
	// e.g -0.37
	Longitude float64 `protobuf:"fixed64,5,opt,name=longitude,proto3" json:"longitude,omitempty"`
	// the timezone e.g Europe/London
	Timezone string `protobuf:"bytes,6,opt,name=timezone,proto3" json:"timezone,omitempty"`
	// the abbreviated code e.g BST
	Abbreviation string `protobuf:"bytes,7,opt,name=abbreviation,proto3" json:"abbreviation,omitempty"`
	// the local time
	Localtime string `protobuf:"bytes,8,opt,name=localtime,proto3" json:"localtime,omitempty"`
	// is daylight savings
	Dst bool `protobuf:"varint,9,opt,name=dst,proto3" json:"dst,omitempty"`
	// UTC offset in hours
	Offset int32 `protobuf:"varint,10,opt,name=offset,proto3" json:"offset,omitempty"`
	// contains filtered or unexported fields
}

func (*ZoneResponse) Descriptor deprecated

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

Deprecated: Use ZoneResponse.ProtoReflect.Descriptor instead.

func (*ZoneResponse) GetAbbreviation

func (x *ZoneResponse) GetAbbreviation() string

func (*ZoneResponse) GetCountry

func (x *ZoneResponse) GetCountry() string

func (*ZoneResponse) GetDst

func (x *ZoneResponse) GetDst() bool

func (*ZoneResponse) GetLatitude

func (x *ZoneResponse) GetLatitude() float64

func (*ZoneResponse) GetLocaltime

func (x *ZoneResponse) GetLocaltime() string

func (*ZoneResponse) GetLocation

func (x *ZoneResponse) GetLocation() string

func (*ZoneResponse) GetLongitude

func (x *ZoneResponse) GetLongitude() float64

func (*ZoneResponse) GetOffset added in v0.26.0

func (x *ZoneResponse) GetOffset() int32

func (*ZoneResponse) GetRegion

func (x *ZoneResponse) GetRegion() string

func (*ZoneResponse) GetTimezone

func (x *ZoneResponse) GetTimezone() string

func (*ZoneResponse) ProtoMessage

func (*ZoneResponse) ProtoMessage()

func (*ZoneResponse) ProtoReflect

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

func (*ZoneResponse) Reset

func (x *ZoneResponse) Reset()

func (*ZoneResponse) String

func (x *ZoneResponse) String() string

Jump to

Keyboard shortcuts

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