common

package module
v0.0.0-...-afd3805 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2019 License: Apache-2.0 Imports: 5 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	MIN_LATITUDE  = float64(-90)
	MAX_LATITUDE  = float64(90)
	MIN_LONGITUDE = float64(-180)
	MAX_LONGITUDE = float64(180)
)

Variables

View Source
var OtherTime_name = map[int32]string{
	0: "NONE",
	1: "AS_SOON_AS",
}
View Source
var OtherTime_value = map[string]int32{
	"NONE":       0,
	"AS_SOON_AS": 1,
}

Functions

func DistanceLonLat

func DistanceLonLat(lon1 float64, lat1 float64, lon2 float64, lat2 float64) float64

direct calc distance using lon/lat

func ValidatePoint

func ValidatePoint(p *Point) error

ValidatePoint determins whether a Point is valid. Latitude is in range [-90, 90] and Longitude is in rage [-180, 180].

Types

type Area

type Area struct {
	Points               []*Point `protobuf:"bytes,1,rep,name=points,proto3" json:"points,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Area) Descriptor

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

func (*Area) GetPoints

func (m *Area) GetPoints() []*Point

func (*Area) ProtoMessage

func (*Area) ProtoMessage()

func (*Area) Reset

func (m *Area) Reset()

func (*Area) String

func (m *Area) String() string

func (*Area) XXX_DiscardUnknown

func (m *Area) XXX_DiscardUnknown()

func (*Area) XXX_Marshal

func (m *Area) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Area) XXX_Merge

func (dst *Area) XXX_Merge(src proto.Message)

func (*Area) XXX_Size

func (m *Area) XXX_Size() int

func (*Area) XXX_Unmarshal

func (m *Area) XXX_Unmarshal(b []byte) error

type Areas

type Areas struct {
	Values               []*Area  `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Areas) Descriptor

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

func (*Areas) GetValues

func (m *Areas) GetValues() []*Area

func (*Areas) ProtoMessage

func (*Areas) ProtoMessage()

func (*Areas) Reset

func (m *Areas) Reset()

func (*Areas) String

func (m *Areas) String() string

func (*Areas) XXX_DiscardUnknown

func (m *Areas) XXX_DiscardUnknown()

func (*Areas) XXX_Marshal

func (m *Areas) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Areas) XXX_Merge

func (dst *Areas) XXX_Merge(src proto.Message)

func (*Areas) XXX_Size

func (m *Areas) XXX_Size() int

func (*Areas) XXX_Unmarshal

func (m *Areas) XXX_Unmarshal(b []byte) error

type OtherTime

type OtherTime int32
const (
	OtherTime_NONE       OtherTime = 0
	OtherTime_AS_SOON_AS OtherTime = 1
)

func (OtherTime) EnumDescriptor

func (OtherTime) EnumDescriptor() ([]byte, []int)

func (OtherTime) String

func (x OtherTime) String() string

type Period

type Period struct {
	From                 *timestamp.Timestamp `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
	To                   *timestamp.Timestamp `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"`
	Options              []*RepeatOption      `protobuf:"bytes,3,rep,name=options,proto3" json:"options,omitempty"`
	XXX_NoUnkeyedLiteral struct{}             `json:"-"`
	XXX_unrecognized     []byte               `json:"-"`
	XXX_sizecache        int32                `json:"-"`
}

func (*Period) Descriptor

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

func (*Period) GetFrom

func (m *Period) GetFrom() *timestamp.Timestamp

func (*Period) GetOptions

func (m *Period) GetOptions() []*RepeatOption

func (*Period) GetTo

func (m *Period) GetTo() *timestamp.Timestamp

func (*Period) ProtoMessage

func (*Period) ProtoMessage()

func (*Period) Reset

func (m *Period) Reset()

func (*Period) String

func (m *Period) String() string

func (*Period) XXX_DiscardUnknown

func (m *Period) XXX_DiscardUnknown()

func (*Period) XXX_Marshal

func (m *Period) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Period) XXX_Merge

func (dst *Period) XXX_Merge(src proto.Message)

func (*Period) XXX_Size

func (m *Period) XXX_Size() int

func (*Period) XXX_Unmarshal

func (m *Period) XXX_Unmarshal(b []byte) error

type Periods

type Periods struct {
	Values               []*Period `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

func (*Periods) Descriptor

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

func (*Periods) GetValues

func (m *Periods) GetValues() []*Period

func (*Periods) ProtoMessage

func (*Periods) ProtoMessage()

func (*Periods) Reset

func (m *Periods) Reset()

func (*Periods) String

func (m *Periods) String() string

func (*Periods) XXX_DiscardUnknown

func (m *Periods) XXX_DiscardUnknown()

func (*Periods) XXX_Marshal

func (m *Periods) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Periods) XXX_Merge

func (dst *Periods) XXX_Merge(src proto.Message)

func (*Periods) XXX_Size

func (m *Periods) XXX_Size() int

func (*Periods) XXX_Unmarshal

func (m *Periods) XXX_Unmarshal(b []byte) error

type Place

type Place struct {
	// Types that are valid to be assigned to Value:
	//	*Place_Point
	//	*Place_Areas
	Value                isPlace_Value `protobuf_oneof:"value"`
	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
	XXX_unrecognized     []byte        `json:"-"`
	XXX_sizecache        int32         `json:"-"`
}

func NewPlace

func NewPlace() *Place

NewPlace returns empty Place.

func (*Place) Descriptor

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

func (*Place) GetAreas

func (m *Place) GetAreas() *Areas

func (*Place) GetCentralPoint

func (p *Place) GetCentralPoint() *Point

func (*Place) GetPoint

func (m *Place) GetPoint() *Point

func (*Place) GetValue

func (m *Place) GetValue() isPlace_Value

func (*Place) ProtoMessage

func (*Place) ProtoMessage()

func (*Place) Reset

func (m *Place) Reset()

func (*Place) String

func (m *Place) String() string

func (*Place) WithAreas

func (p *Place) WithAreas(areas [][]*Point) *Place

WithAreas makes []*Area from a given points and set to Place.Place_Areas.Areas.

func (*Place) WithPoint

func (p *Place) WithPoint(point *Point) *Place

WithPoint set a given Point to Place.Place_Point.Point.

func (*Place) XXX_DiscardUnknown

func (m *Place) XXX_DiscardUnknown()

func (*Place) XXX_Marshal

func (m *Place) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Place) XXX_Merge

func (dst *Place) XXX_Merge(src proto.Message)

func (*Place) XXX_OneofFuncs

func (*Place) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

func (*Place) XXX_Size

func (m *Place) XXX_Size() int

func (*Place) XXX_Unmarshal

func (m *Place) XXX_Unmarshal(b []byte) error

type Place_Areas

type Place_Areas struct {
	Areas *Areas `protobuf:"bytes,2,opt,name=areas,proto3,oneof"`
}

type Place_Point

type Place_Point struct {
	Point *Point `protobuf:"bytes,1,opt,name=point,proto3,oneof"`
}

type Point

type Point struct {
	Latitude             float64  `protobuf:"fixed64,1,opt,name=latitude,proto3" json:"latitude,omitempty"`
	Longitude            float64  `protobuf:"fixed64,2,opt,name=longitude,proto3" json:"longitude,omitempty"`
	Name                 string   `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Point) AddPoint

func (pt1 *Point) AddPoint(pt2 *Point) *Point

func (*Point) Descriptor

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

func (*Point) Distance

func (p1 *Point) Distance(p2 *Point) (float64, error)

calculate distance using Hubeny formula.

func (*Point) DividePoint

func (pt1 *Point) DividePoint(d float64) *Point

func (*Point) GetLatitude

func (m *Point) GetLatitude() float64

func (*Point) GetLongitude

func (m *Point) GetLongitude() float64

func (*Point) GetName

func (m *Point) GetName() string

func (*Point) IsSamePoint

func (p1 *Point) IsSamePoint(p2 *Point, r float64) bool

IsSamePoint determins whether two points are same. If r is 0, matching is strict. Otherwise, matching is lenient. (consider as same if they are within r meters)

func (*Point) ProtoMessage

func (*Point) ProtoMessage()

func (*Point) Reset

func (m *Point) Reset()

func (*Point) String

func (m *Point) String() string

func (*Point) XXX_DiscardUnknown

func (m *Point) XXX_DiscardUnknown()

func (*Point) XXX_Marshal

func (m *Point) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Point) XXX_Merge

func (dst *Point) XXX_Merge(src proto.Message)

func (*Point) XXX_Size

func (m *Point) XXX_Size() int

func (*Point) XXX_Unmarshal

func (m *Point) XXX_Unmarshal(b []byte) error

type RepeatOption

type RepeatOption struct {
	Weeks                []bool   `protobuf:"varint,1,rep,packed,name=weeks,proto3" json:"weeks,omitempty"`
	Weekdays             []bool   `protobuf:"varint,2,rep,packed,name=weekdays,proto3" json:"weekdays,omitempty"`
	Times                []uint32 `protobuf:"varint,3,rep,packed,name=times,proto3" json:"times,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*RepeatOption) Descriptor

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

func (*RepeatOption) GetTimes

func (m *RepeatOption) GetTimes() []uint32

func (*RepeatOption) GetWeekdays

func (m *RepeatOption) GetWeekdays() []bool

func (*RepeatOption) GetWeeks

func (m *RepeatOption) GetWeeks() []bool

func (*RepeatOption) ProtoMessage

func (*RepeatOption) ProtoMessage()

func (*RepeatOption) Reset

func (m *RepeatOption) Reset()

func (*RepeatOption) String

func (m *RepeatOption) String() string

func (*RepeatOption) XXX_DiscardUnknown

func (m *RepeatOption) XXX_DiscardUnknown()

func (*RepeatOption) XXX_Marshal

func (m *RepeatOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RepeatOption) XXX_Merge

func (dst *RepeatOption) XXX_Merge(src proto.Message)

func (*RepeatOption) XXX_Size

func (m *RepeatOption) XXX_Size() int

func (*RepeatOption) XXX_Unmarshal

func (m *RepeatOption) XXX_Unmarshal(b []byte) error

type Time

type Time struct {
	// Types that are valid to be assigned to Value:
	//	*Time_Timestamp
	//	*Time_Periods
	//	*Time_Other
	Value                isTime_Value `protobuf_oneof:"value"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

func NewTime

func NewTime() *Time

NewTime returns empty Time.

func (*Time) Descriptor

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

func (*Time) GetOther

func (m *Time) GetOther() OtherTime

func (*Time) GetPeriods

func (m *Time) GetPeriods() *Periods

func (*Time) GetTimestamp

func (m *Time) GetTimestamp() *timestamp.Timestamp

func (*Time) GetValue

func (m *Time) GetValue() isTime_Value

func (*Time) ProtoMessage

func (*Time) ProtoMessage()

func (*Time) Reset

func (m *Time) Reset()

func (*Time) String

func (m *Time) String() string

func (*Time) WithOtherTime

func (t *Time) WithOtherTime(other OtherTime) *Time

WithOtherTime set a given time to Time.Time_Other.Other.

func (*Time) WithPeriods

func (t *Time) WithPeriods(periods []*Period) *Time

WithPeriods set given periods to Time.Time_Periods.Periods.

func (*Time) WithTimestamp

func (t *Time) WithTimestamp(ts *timestamp.Timestamp) *Time

WithTimestamp set a given timestamp to Time.Time_Timestamp.Timestamp.

func (*Time) XXX_DiscardUnknown

func (m *Time) XXX_DiscardUnknown()

func (*Time) XXX_Marshal

func (m *Time) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Time) XXX_Merge

func (dst *Time) XXX_Merge(src proto.Message)

func (*Time) XXX_OneofFuncs

func (*Time) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

func (*Time) XXX_Size

func (m *Time) XXX_Size() int

func (*Time) XXX_Unmarshal

func (m *Time) XXX_Unmarshal(b []byte) error

type Time_Other

type Time_Other struct {
	Other OtherTime `protobuf:"varint,3,opt,name=other,proto3,enum=api.common.OtherTime,oneof"`
}

type Time_Periods

type Time_Periods struct {
	Periods *Periods `protobuf:"bytes,2,opt,name=periods,proto3,oneof"`
}

type Time_Timestamp

type Time_Timestamp struct {
	Timestamp *timestamp.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof"`
}

Jump to

Keyboard shortcuts

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