convert

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: Apache-2.0 Imports: 15 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromRPCAggregateQueryRawRequest added in v0.8.0

func FromRPCAggregateQueryRawRequest(
	req *rpc.AggregateQueryRawRequest,
	pools FetchTaggedConversionPools,
) (ident.ID, index.Query, index.AggregationOptions, error)

FromRPCAggregateQueryRawRequest converts the rpc request type for AggregateRawQueryRequest into corresponding Go API types.

func FromRPCAggregateQueryRequest added in v0.8.0

func FromRPCAggregateQueryRequest(
	req *rpc.AggregateQueryRequest,
) (ident.ID, index.Query, index.AggregationOptions, error)

FromRPCAggregateQueryRequest converts the rpc request type for AggregateRawQueryRequest into corresponding Go API types.

func FromRPCFetchTaggedRequest

func FromRPCFetchTaggedRequest(
	req *rpc.FetchTaggedRequest, pools FetchTaggedConversionPools,
) (ident.ID, index.Query, index.QueryOptions, bool, error)

FromRPCFetchTaggedRequest converts the rpc request type for FetchTaggedRequest into corresponding Go API types.

func FromRPCQuery

func FromRPCQuery(query *rpc.Query) (idx.Query, error)

FromRPCQuery will create a m3ninx index query from an RPC query. NB: a nil query is considered equivalent to an `All` query.

func ToDuration

func ToDuration(timeType rpc.TimeType) (time.Duration, error)

ToDuration converts a time type to a duration

func ToRPCAggregateQueryRawRequest added in v0.8.0

func ToRPCAggregateQueryRawRequest(
	ns ident.ID,
	q index.Query,
	opts index.AggregationOptions,
) (rpc.AggregateQueryRawRequest, error)

ToRPCAggregateQueryRawRequest converts the Go `client/` types into rpc request type for AggregateQueryRawRequest.

func ToRPCError

func ToRPCError(err error) *rpc.Error

ToRPCError converts a server error to a RPC error.

func ToRPCFetchTaggedRequest

func ToRPCFetchTaggedRequest(
	ns ident.ID,
	q index.Query,
	opts index.QueryOptions,
	fetchData bool,
) (rpc.FetchTaggedRequest, error)

ToRPCFetchTaggedRequest converts the Go `client/` types into rpc request type for FetchTaggedRequest.

func ToTagsIter

func ToTagsIter(r *rpc.WriteTaggedRequest) (ident.TagIterator, error)

ToTagsIter returns a tag iterator over the given request.

func ToTime

func ToTime(value int64, timeType rpc.TimeType) (time.Time, error)

ToTime converts a value to a time

func ToTimeType

func ToTimeType(unit xtime.Unit) (rpc.TimeType, error)

ToTimeType converts a unit to a time type

func ToUnit

func ToUnit(timeType rpc.TimeType) (xtime.Unit, error)

ToUnit converts a time type to a unit

func ToValue

func ToValue(t time.Time, timeType rpc.TimeType) (int64, error)

ToValue converts a time to a value

Types

type FetchTaggedConversionPools

type FetchTaggedConversionPools interface {
	// ID returns an ident.Pool
	ID() ident.Pool

	// CheckedBytesWrapperPool returns a CheckedBytesWrapperPool.
	CheckedBytesWrapper() xpool.CheckedBytesWrapperPool
}

FetchTaggedConversionPools allows users to pass a pool for conversions.

type ToSegmentsResult

type ToSegmentsResult struct {
	Segments *rpc.Segments
	Checksum *int64
}

ToSegmentsResult is the result of a convert to segments call, if the segments were merged then checksum is ptr to the checksum otherwise it is nil.

func ToSegments

func ToSegments(blocks []xio.BlockReader) (ToSegmentsResult, error)

ToSegments converts a list of blocks to segments.

Jump to

Keyboard shortcuts

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