mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-18 21:55:08 +00:00
replace timezone with time
This commit is contained in:
475
time/proto/time.pb.go
Normal file
475
time/proto/time.pb.go
Normal file
@@ -0,0 +1,475 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.15.6
|
||||
// source: proto/time.proto
|
||||
|
||||
package time
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// Get the current time
|
||||
type NowRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// optional location, otherwise returns UTC
|
||||
Location string `protobuf:"bytes,1,opt,name=location,proto3" json:"location,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NowRequest) Reset() {
|
||||
*x = NowRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_time_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NowRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NowRequest) ProtoMessage() {}
|
||||
|
||||
func (x *NowRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_time_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NowRequest.ProtoReflect.Descriptor instead.
|
||||
func (*NowRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_time_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *NowRequest) GetLocation() string {
|
||||
if x != nil {
|
||||
return x.Location
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type NowResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// 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"`
|
||||
}
|
||||
|
||||
func (x *NowResponse) Reset() {
|
||||
*x = NowResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_time_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NowResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NowResponse) ProtoMessage() {}
|
||||
|
||||
func (x *NowResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_time_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NowResponse.ProtoReflect.Descriptor instead.
|
||||
func (*NowResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_time_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *NowResponse) GetLocaltime() string {
|
||||
if x != nil {
|
||||
return x.Localtime
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NowResponse) GetTimestamp() string {
|
||||
if x != nil {
|
||||
return x.Timestamp
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NowResponse) GetLocation() string {
|
||||
if x != nil {
|
||||
return x.Location
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NowResponse) GetTimezone() string {
|
||||
if x != nil {
|
||||
return x.Timezone
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NowResponse) GetUnix() int64 {
|
||||
if x != nil {
|
||||
return x.Unix
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// Get the timezone info for a specific location
|
||||
type ZoneRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// location to lookup e.g postcode, city, ip address
|
||||
Location string `protobuf:"bytes,1,opt,name=location,proto3" json:"location,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ZoneRequest) Reset() {
|
||||
*x = ZoneRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_time_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ZoneRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ZoneRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ZoneRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_time_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ZoneRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ZoneRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_time_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *ZoneRequest) GetLocation() string {
|
||||
if x != nil {
|
||||
return x.Location
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ZoneResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// 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"`
|
||||
}
|
||||
|
||||
func (x *ZoneResponse) Reset() {
|
||||
*x = ZoneResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_time_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ZoneResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ZoneResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ZoneResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_time_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ZoneResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ZoneResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_time_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *ZoneResponse) GetLocation() string {
|
||||
if x != nil {
|
||||
return x.Location
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ZoneResponse) GetRegion() string {
|
||||
if x != nil {
|
||||
return x.Region
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ZoneResponse) GetCountry() string {
|
||||
if x != nil {
|
||||
return x.Country
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ZoneResponse) GetLatitude() float64 {
|
||||
if x != nil {
|
||||
return x.Latitude
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ZoneResponse) GetLongitude() float64 {
|
||||
if x != nil {
|
||||
return x.Longitude
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ZoneResponse) GetTimezone() string {
|
||||
if x != nil {
|
||||
return x.Timezone
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ZoneResponse) GetAbbreviation() string {
|
||||
if x != nil {
|
||||
return x.Abbreviation
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ZoneResponse) GetLocaltime() string {
|
||||
if x != nil {
|
||||
return x.Localtime
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ZoneResponse) GetDst() bool {
|
||||
if x != nil {
|
||||
return x.Dst
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var File_proto_time_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_proto_time_proto_rawDesc = []byte{
|
||||
0x0a, 0x10, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x12, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x28, 0x0a, 0x0a, 0x4e, 0x6f, 0x77, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x22, 0x95, 0x01, 0x0a, 0x0b, 0x4e, 0x6f, 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x74, 0x69, 0x6d, 0x65, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x74, 0x69, 0x6d, 0x65,
|
||||
0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1a,
|
||||
0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x69,
|
||||
0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x69,
|
||||
0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x6e, 0x69, 0x78, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x75, 0x6e, 0x69, 0x78, 0x22, 0x29, 0x0a, 0x0b, 0x5a, 0x6f,
|
||||
0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x86, 0x02, 0x0a, 0x0c, 0x5a, 0x6f, 0x6e, 0x65, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65,
|
||||
0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x05, 0x20,
|
||||
0x01, 0x28, 0x01, 0x52, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1a,
|
||||
0x0a, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x62,
|
||||
0x62, 0x72, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0c, 0x61, 0x62, 0x62, 0x72, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c,
|
||||
0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03,
|
||||
0x64, 0x73, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x64, 0x73, 0x74, 0x32, 0x65,
|
||||
0x0a, 0x04, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x03, 0x4e, 0x6f, 0x77, 0x12, 0x10, 0x2e,
|
||||
0x74, 0x69, 0x6d, 0x65, 0x2e, 0x4e, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x11, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x4e, 0x6f, 0x77, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x04, 0x5a, 0x6f, 0x6e, 0x65, 0x12, 0x11, 0x2e, 0x74,
|
||||
0x69, 0x6d, 0x65, 0x2e, 0x5a, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x12, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x5a, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x3b, 0x74, 0x69, 0x6d, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_proto_time_proto_rawDescOnce sync.Once
|
||||
file_proto_time_proto_rawDescData = file_proto_time_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_proto_time_proto_rawDescGZIP() []byte {
|
||||
file_proto_time_proto_rawDescOnce.Do(func() {
|
||||
file_proto_time_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_time_proto_rawDescData)
|
||||
})
|
||||
return file_proto_time_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_proto_time_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_proto_time_proto_goTypes = []interface{}{
|
||||
(*NowRequest)(nil), // 0: time.NowRequest
|
||||
(*NowResponse)(nil), // 1: time.NowResponse
|
||||
(*ZoneRequest)(nil), // 2: time.ZoneRequest
|
||||
(*ZoneResponse)(nil), // 3: time.ZoneResponse
|
||||
}
|
||||
var file_proto_time_proto_depIdxs = []int32{
|
||||
0, // 0: time.Time.Now:input_type -> time.NowRequest
|
||||
2, // 1: time.Time.Zone:input_type -> time.ZoneRequest
|
||||
1, // 2: time.Time.Now:output_type -> time.NowResponse
|
||||
3, // 3: time.Time.Zone:output_type -> time.ZoneResponse
|
||||
2, // [2:4] is the sub-list for method output_type
|
||||
0, // [0:2] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_proto_time_proto_init() }
|
||||
func file_proto_time_proto_init() {
|
||||
if File_proto_time_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_proto_time_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NowRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_time_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NowResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_time_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ZoneRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_time_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ZoneResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_proto_time_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_proto_time_proto_goTypes,
|
||||
DependencyIndexes: file_proto_time_proto_depIdxs,
|
||||
MessageInfos: file_proto_time_proto_msgTypes,
|
||||
}.Build()
|
||||
File_proto_time_proto = out.File
|
||||
file_proto_time_proto_rawDesc = nil
|
||||
file_proto_time_proto_goTypes = nil
|
||||
file_proto_time_proto_depIdxs = nil
|
||||
}
|
||||
110
time/proto/time.pb.micro.go
Normal file
110
time/proto/time.pb.micro.go
Normal file
@@ -0,0 +1,110 @@
|
||||
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
||||
// source: proto/time.proto
|
||||
|
||||
package time
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
math "math"
|
||||
)
|
||||
|
||||
import (
|
||||
context "context"
|
||||
api "github.com/micro/micro/v3/service/api"
|
||||
client "github.com/micro/micro/v3/service/client"
|
||||
server "github.com/micro/micro/v3/service/server"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ api.Endpoint
|
||||
var _ context.Context
|
||||
var _ client.Option
|
||||
var _ server.Option
|
||||
|
||||
// Api Endpoints for Time service
|
||||
|
||||
func NewTimeEndpoints() []*api.Endpoint {
|
||||
return []*api.Endpoint{}
|
||||
}
|
||||
|
||||
// Client API for Time service
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
type timeService struct {
|
||||
c client.Client
|
||||
name string
|
||||
}
|
||||
|
||||
func NewTimeService(name string, c client.Client) TimeService {
|
||||
return &timeService{
|
||||
c: c,
|
||||
name: name,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *timeService) Now(ctx context.Context, in *NowRequest, opts ...client.CallOption) (*NowResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Time.Now", in)
|
||||
out := new(NowResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *timeService) Zone(ctx context.Context, in *ZoneRequest, opts ...client.CallOption) (*ZoneResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Time.Zone", in)
|
||||
out := new(ZoneResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for Time service
|
||||
|
||||
type TimeHandler interface {
|
||||
Now(context.Context, *NowRequest, *NowResponse) error
|
||||
Zone(context.Context, *ZoneRequest, *ZoneResponse) error
|
||||
}
|
||||
|
||||
func RegisterTimeHandler(s server.Server, hdlr TimeHandler, opts ...server.HandlerOption) error {
|
||||
type time interface {
|
||||
Now(ctx context.Context, in *NowRequest, out *NowResponse) error
|
||||
Zone(ctx context.Context, in *ZoneRequest, out *ZoneResponse) error
|
||||
}
|
||||
type Time struct {
|
||||
time
|
||||
}
|
||||
h := &timeHandler{hdlr}
|
||||
return s.Handle(s.NewHandler(&Time{h}, opts...))
|
||||
}
|
||||
|
||||
type timeHandler struct {
|
||||
TimeHandler
|
||||
}
|
||||
|
||||
func (h *timeHandler) Now(ctx context.Context, in *NowRequest, out *NowResponse) error {
|
||||
return h.TimeHandler.Now(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *timeHandler) Zone(ctx context.Context, in *ZoneRequest, out *ZoneResponse) error {
|
||||
return h.TimeHandler.Zone(ctx, in, out)
|
||||
}
|
||||
58
time/proto/time.proto
Normal file
58
time/proto/time.proto
Normal file
@@ -0,0 +1,58 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package time;
|
||||
|
||||
option go_package = "./proto;time";
|
||||
|
||||
service Time {
|
||||
rpc Now(NowRequest) returns (NowResponse) {}
|
||||
rpc Zone(ZoneRequest) returns (ZoneResponse) {}
|
||||
}
|
||||
|
||||
// Get the current time
|
||||
message NowRequest {
|
||||
// optional location, otherwise returns UTC
|
||||
string location = 1;
|
||||
}
|
||||
|
||||
message NowResponse {
|
||||
// the current time as HH:MM:SS
|
||||
string localtime = 1;
|
||||
// timestamp as 2006-01-02T15:04:05.999999999Z07:00
|
||||
string timestamp = 2;
|
||||
// the location as Europe/London
|
||||
string location = 3;
|
||||
// the timezone as BST
|
||||
string timezone = 4;
|
||||
// the unix timestamp
|
||||
int64 unix = 5;
|
||||
|
||||
}
|
||||
|
||||
// Get the timezone info for a specific location
|
||||
message ZoneRequest {
|
||||
// location to lookup e.g postcode, city, ip address
|
||||
string location = 1;
|
||||
}
|
||||
|
||||
message ZoneResponse {
|
||||
// location requested
|
||||
string location = 1;
|
||||
// region of timezone
|
||||
string region = 2;
|
||||
// country of the timezone
|
||||
string country = 3;
|
||||
// e.g 51.42
|
||||
double latitude = 4;
|
||||
// e.g -0.37
|
||||
double longitude = 5;
|
||||
// the timezone e.g Europe/London
|
||||
string timezone = 6;
|
||||
// the abbreviated code e.g BST
|
||||
string abbreviation = 7;
|
||||
// the local time
|
||||
string localtime = 8;
|
||||
// is daylight savings
|
||||
bool dst = 9;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user