utils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2018 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GolangMemoryFootprintFactor is a rough estimation of the factor
	// of memory occupied by golang against application live data set
	// (memory occupied by application objects).
	GolangMemoryFootprintFactor = 2
)

Variables

View Source
var (
	// TestingT is the global singleton for TestingTMock.
	TestingT = &TestingTMock{}
)

Functions

func AddTableShardReporter

func AddTableShardReporter(tableName string, shardID int)

AddTableShardReporter adds a reporter for the given table and shards. It should be called when bootstrap the table shards or shard ownership changes.

func AdjustOffset

func AdjustOffset(fromOffset, toOffset int, switchTs, ts int64) int64

AdjustOffset adjusts timestamp value with time range start or end ts basing on DST switch ts

func AlignOffset

func AlignOffset(offset int, alignment int) int

AlignOffset returns the next offset given a specific alignment.

func ApplyHTTPWrappers

func ApplyHTTPWrappers(handler http.HandlerFunc, wrappers []HTTPHandlerWrapper) http.HandlerFunc

ApplyHTTPWrappers apply wrappers according to the order

func BoolFlag

func BoolFlag(longName, shortName string, defaultValue bool, description string) *bool

BoolFlag creates a boolean based command option.

func CalculateDSTSwitchTs

func CalculateDSTSwitchTs(fromTs, toTs int64, loc *time.Location) (switchTs int64, err error)

CalculateDSTSwitchTs calculates DST switch timestamp given a time range and a timezone it returns 0 if given range doesn't contain a switch for that zone it assumes the range won't contain more than 1 switch timestamp, otherwise it will return one of them (which one to return is not determined)

func CrossDST

func CrossDST(fromTs, toTs int64, loc *time.Location) bool

CrossDST tells whether a time range crosses a DST switch time for given zone

func DeleteTableShardReporter

func DeleteTableShardReporter(tableName string, shardID int)

DeleteTableShardReporter deletes the reporter for the given table and shards. It should be called when the table shard no longer belongs to current node.

func FormatTimeStampToUTC

func FormatTimeStampToUTC(ts int64) string

FormatTimeStampToUTC formats a epoch timestamp to a time string in UTC time zone.

func GetConfig

func GetConfig() common.AresServerConfig

GetConfig returns the application config.

func GetFuncName

func GetFuncName(f interface{}) string

GetFuncName returns the function name given a function pointer. It will only return the last part of the name.

func GetLogger

func GetLogger() bark.Logger

GetLogger returns the logger.

func GetOrigin

func GetOrigin(r *http.Request) string

GetOrigin returns the caller of the request.

func GetQueryLogger

func GetQueryLogger() bark.Logger

GetQueryLogger returns the logger for query.

func IndexOfInt

func IndexOfInt(s []int, e int) int

IndexOfInt finds the index of a target int inside a slice of ints, return -1 if not found

func IndexOfStr

func IndexOfStr(strs []string, target string) int

IndexOfStr finds the index of a target string inside a slice of strings, return -1 if not found

func Init

Init loads application specific common components settings.

func IntFlag

func IntFlag(longName, shortName string, defaultValue int, description string) *int

IntFlag creates a int based command option.

func IsDev

func IsDev() bool

func IsProd

func IsProd() bool

func IsStaging

func IsStaging() bool

func IsTest

func IsTest() bool

func LimitServe

func LimitServe(port int, handler http.Handler, httpCfg common.HTTPConfig)

LimitServe will start a http server on the port with the handler and at most maxConnection concurrent connections.

func Murmur3Sum32

func Murmur3Sum32(key unsafe.Pointer, bytes int, seed uint32) uint32

Murmur3Sum32 implements Murmur3Sum32 hash algorithm

func NoCache

func NoCache(h http.Handler) http.Handler

NoCache sets no cache headers and removes any ETag headers that may have been set.

func NoopHTTPWrapper

func NoopHTTPWrapper(h http.HandlerFunc) http.HandlerFunc

NoopHTTPWrapper does nothing; used for testing

func NormalizeUUIDString

func NormalizeUUIDString(uuidStr string) (string, error)

NormalizeUUIDString normailizes a uuid string by applying following rules. If it's not a valid uuid str, it will raise an error. 1. remove 0x prefix if any 2. convert to uppercase 3. remove -

func Now

func Now() time.Time

Now returns current time using nowFunc

func RecoverWrap

func RecoverWrap(call func() error) (err error)

RecoverWrap recover all panics inside the passed in func

func ResetClockImplementation

func ResetClockImplementation()

ResetClockImplementation resets implementation to use time.Now

func SetClockImplementation

func SetClockImplementation(f NowFunc)

SetClockImplementation sets implementation to use passed in nowFunc

func SetCurrentTime

func SetCurrentTime(t time.Time)

SetCurrentTime sets the clock implementation to the specified time,

func StringFlag

func StringFlag(longName, shortName string, defaultValue string, description string) *string

StringFlag creates a string based command option.

func TimeStampToUTC

func TimeStampToUTC(ts int64) time.Time

TimeStampToUTC converts a timestamp to a Time struct in UTC time zone.

func WithMetricsFunc

func WithMetricsFunc(h http.HandlerFunc) http.HandlerFunc

WithMetricsFunc will send stats like latency, rps and returning status code after the http handler finishes. It has to be applied to the actual handler function who serves the http request.

func WriteTable

func WriteTable(dataSource TableDataSource) string

WriteTable renders a tabular representation from underlying data source. If there is no column for this data source, it will return an empty string. All elements of the table will be right justify (left padding). Column splitter is "|" for now.

Types

type APIError

type APIError struct {
	Code    int    `json:"-"`
	Message string `json:"message"`
	Cause   error  `json:"cause"`
}

APIError ...

func (APIError) Error

func (e APIError) Error() string

type AresEnv

type AresEnv string
const (
	EnvProd    AresEnv = "production"
	EnvStaging AresEnv = "staging"
	EnvDev     AresEnv = "development"
	EnvTest    AresEnv = "test"
)

func GetAresEnv

func GetAresEnv() AresEnv

type BufferReader

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

BufferReader provides read function for different type to read from the underline buffer.

func NewBufferReader

func NewBufferReader(buffer []byte) BufferReader

NewBufferReader creates a BufferReader.

func (BufferReader) ReadFloat32

func (b BufferReader) ReadFloat32(offset int) (float32, error)

ReadFloat32 reads 4 bytes from buffer.

func (BufferReader) ReadInt16

func (b BufferReader) ReadInt16(offset int) (int16, error)

ReadInt16 reads 2 bytes from buffer.

func (BufferReader) ReadInt32

func (b BufferReader) ReadInt32(offset int) (int32, error)

ReadInt32 reads 4 bytes from buffer.

func (BufferReader) ReadInt8

func (b BufferReader) ReadInt8(offset int) (int8, error)

ReadInt8 reads 1 byte from buffer.

func (BufferReader) ReadUint16

func (b BufferReader) ReadUint16(offset int) (uint16, error)

ReadUint16 reads 2 bytes from buffer.

func (BufferReader) ReadUint32

func (b BufferReader) ReadUint32(offset int) (uint32, error)

ReadUint32 reads 4 bytes from buffer.

func (BufferReader) ReadUint64

func (b BufferReader) ReadUint64(offset int) (uint64, error)

ReadUint64 reads 8 bytes from buffer.

func (BufferReader) ReadUint8

func (b BufferReader) ReadUint8(offset int) (uint8, error)

ReadUint8 reads 1 byte from buffer.

type BufferWriter

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

BufferWriter provides functions to write different data types into the underline buffer. It supports both random access and sequential access.

func NewBufferWriter

func NewBufferWriter(buffer []byte) BufferWriter

NewBufferWriter creates a new buffer writer over a buffer.

func (*BufferWriter) AlignBytes

func (b *BufferWriter) AlignBytes(alignment int)

AlignBytes aligns the offset/bit offset to the next byte specified in alignment. The new offset may cross the buffer boundary.

func (*BufferWriter) Append

func (b *BufferWriter) Append(bs []byte) error

Append writes a byte slice to buffer and advances offset.

func (*BufferWriter) AppendBool

func (b *BufferWriter) AppendBool(value bool) error

AppendBool append a boolean value to buffer and advances byte/bit offset.

func (*BufferWriter) AppendFloat32

func (b *BufferWriter) AppendFloat32(value float32) error

AppendFloat32 writes a float32 value to buffer and advances offset.

func (*BufferWriter) AppendInt16

func (b *BufferWriter) AppendInt16(value int16) error

AppendInt16 writes a int16 value to buffer and advances offset.

func (*BufferWriter) AppendInt32

func (b *BufferWriter) AppendInt32(value int32) error

AppendInt32 writes a int32 value to buffer and advances offset.

func (*BufferWriter) AppendInt64

func (b *BufferWriter) AppendInt64(value int64) error

AppendInt64 writes a int64 value to buffer and advances offset.

func (*BufferWriter) AppendInt8

func (b *BufferWriter) AppendInt8(value int8) error

AppendInt8 writes a int8 value to buffer and advances offset.

func (*BufferWriter) AppendUint16

func (b *BufferWriter) AppendUint16(value uint16) error

AppendUint16 writes a uint16 value to buffer and advances offset.

func (*BufferWriter) AppendUint32

func (b *BufferWriter) AppendUint32(value uint32) error

AppendUint32 writes a uint32 value to buffer and advances offset.

func (*BufferWriter) AppendUint64

func (b *BufferWriter) AppendUint64(value uint64) error

AppendUint64 writes a uint64 value to buffer and advances offset.

func (*BufferWriter) AppendUint8

func (b *BufferWriter) AppendUint8(value uint8) error

AppendUint8 writes a uint8 value to buffer and advances offset.

func (BufferWriter) GetOffset

func (b BufferWriter) GetOffset() int

GetOffset returns the current offset value.

func (*BufferWriter) SkipBits

func (b *BufferWriter) SkipBits(bits int)

SkipBits moves the bit offset and possibly byte offset. The new offset may cross the buffer boundary.

func (*BufferWriter) SkipBytes

func (b *BufferWriter) SkipBytes(bytes int)

SkipBytes moves the underline offset by specified bytes. The new offset may cross the buffer boundary.

func (*BufferWriter) Write

func (b *BufferWriter) Write(bs []byte) (int, error)

Write implements Write in io.Writer interface

func (*BufferWriter) WriteAt

func (b *BufferWriter) WriteAt(bs []byte, offset int64) (int, error)

WriteAt implements WriteAt in io.WriterAt interface

func (*BufferWriter) WriteFloat32

func (b *BufferWriter) WriteFloat32(value float32, offset int) error

WriteFloat32 writes a float32 value to buffer and advances offset.

func (*BufferWriter) WriteInt16

func (b *BufferWriter) WriteInt16(value int16, offset int) error

WriteInt16 writes a int16 value to buffer and advances offset.

func (*BufferWriter) WriteInt32

func (b *BufferWriter) WriteInt32(value int32, offset int) error

WriteInt32 writes a int32 value to buffer and advances offset.

func (*BufferWriter) WriteInt64

func (b *BufferWriter) WriteInt64(value int64, offset int) error

WriteInt64 writes a int64 value to buffer and advances offset.

func (*BufferWriter) WriteInt8

func (b *BufferWriter) WriteInt8(value int8, offset int) error

WriteInt8 writes a int8 value to buffer at given offset.

func (*BufferWriter) WriteUint16

func (b *BufferWriter) WriteUint16(value uint16, offset int) error

WriteUint16 writes a uint16 value to buffer and advances offset.

func (*BufferWriter) WriteUint32

func (b *BufferWriter) WriteUint32(value uint32, offset int) error

WriteUint32 writes a uint32 value to buffer and advances offset.

func (*BufferWriter) WriteUint64

func (b *BufferWriter) WriteUint64(value uint64, offset int) error

WriteUint64 writes a uint64 value to buffer and advances offset.

func (*BufferWriter) WriteUint8

func (b *BufferWriter) WriteUint8(value uint8, offset int) error

WriteUint8 writes a uint8 value to buffer and advances offset.

type ClosableBuffer

type ClosableBuffer struct {
	*bytes.Buffer
}

ClosableBuffer is not really closable but just implements the io.WriteCloser interface.

func (*ClosableBuffer) Close

func (cb *ClosableBuffer) Close() error

Close just implements Close function of io.WriteCloser interface.

type ClosableReader

type ClosableReader struct {
	*bytes.Reader
}

ClosableReader is not really closable but just implements the io.ReadCloser interface.

func (*ClosableReader) Close

func (cr *ClosableReader) Close() error

Close just implements Close function of io.ReadCloser interface.

type FileSystem

type FileSystem interface {
	ReadFile(filename string) ([]byte, error)
	ReadDir(dirname string) ([]os.FileInfo, error)
	Stat(path string) (os.FileInfo, error)
	Mkdir(name string, perm os.FileMode) error
	MkdirAll(path string, perm os.FileMode) error
	Remove(path string) error
	RemoveAll(path string) error
	OpenFileForWrite(name string, flag int, perm os.FileMode) (io.WriteCloser, error)
}

FileSystem is a file system interface

type HTTPHandlerWrapper

type HTTPHandlerWrapper func(handler http.HandlerFunc) http.HandlerFunc

HTTPHandlerWrapper wraps context aware httpHandler

type Int64Array

type Int64Array []int64

Int64Array is the holder object for []int64 and implementations for Sort interfaces.

func (Int64Array) Len

func (s Int64Array) Len() int

func (Int64Array) Less

func (s Int64Array) Less(i, j int) bool

func (Int64Array) Swap

func (s Int64Array) Swap(i, j int)

type MetricName

type MetricName int

MetricName is the type of the metric.

const (
	AllocatedDeviceMemory MetricName = iota
	ArchivingIgnoredRecords
	ArchivingRecords
	ArchivingTimingTotal
	ArchivingHighWatermark
	ArchivingLowWatermark
	BackfillTimingTotal
	BackfillLockTiming
	EstimatedDeviceMemory
	HTTPHandlerCall
	HTTPHandlerLatency
	IngestedRecords
	AppendedRecords
	UpdatedRecords
	IngestedUpsertBatches
	PrimaryKeyMissing
	TimeColumnMissing
	BackfillRecords
	BackfillAffectedDays
	BackfillNewRecords
	BackfillNoEffectRecords
	BackfillInplaceUpdateRecords
	BackfillDeleteThenInsertRecords
	BackfillRecordsTimeDifference
	BackfillRecordsRatio
	BackfillRecordsColumnRemoved
	DuplicateRecordRatio
	RecoveryIgnoredRecordsTimeDifference
	RecoveryIgnoredRecords
	RecoveryLatency
	TotalMemorySize
	UnmanagedMemorySize
	ManagedMemorySize
	BackfillBufferFillRatio
	BackfillBufferSize
	BackfillBufferNumRecords
	IngestionLagPerColumn
	NumberOfEnumCasesPerColumn
	CurrentRedologCreationTime
	CurrentRedologSize
	NumberOfRedologs
	SizeOfRedologs
	QueryFailed
	QuerySucceeded
	QueryLatency
	QueryWaitForMemoryDuration
	QueryReceived
	QueryLiveRecordsProcessed
	QueryArchiveRecordsProcessed
	QueryLiveBatchProcessed
	QueryArchiveBatchProcessed
	QueryLiveBytesTransferred
	QueryArchiveBytesTransferred
	QueryRowsReturned
	RecordsOutOfRetention
	SnapshotTimingTotal
	SnapshotTimingLoad
	SnapshotTimingBuildIndex
	TimezoneLookupTableCreationTime
	RedoLogFileCorrupt
	MemoryOverflow
	PreloadingZoneEvicted
	PurgeTimingTotal
	PurgedBatches
	RecordsFromFuture
	BatchSize
	BatchSizeReportTime
	SchemaFetchSuccess
	SchemaFetchFailure
	SchemaUpdateCount
	SchemaDeletionCount
	SchemaCreationCount
	// Enum sentinel.
	NumMetricNames
)

List of supported metric names.

type MetricType

type MetricType int

MetricType is the supported metric type.

const (
	Counter MetricType = iota
	Gauge
	Timer
)

MetricTypes which are supported.

type NowFunc

type NowFunc func() time.Time

NowFunc type for function of getting current time

type OSFileSystem

type OSFileSystem struct{}

OSFileSystem implements FileSystem using os package

func (OSFileSystem) Mkdir

func (OSFileSystem) Mkdir(name string, perm os.FileMode) error

Mkdir makes directory with given name and permission

func (OSFileSystem) MkdirAll

func (OSFileSystem) MkdirAll(path string, perm os.FileMode) error

MkdirAll makes directory with necessary parent directories in path

func (OSFileSystem) OpenFileForWrite

func (OSFileSystem) OpenFileForWrite(name string, flag int, perm os.FileMode) (io.WriteCloser, error)

OpenFileForWrite opens a file for write

func (OSFileSystem) ReadDir

func (OSFileSystem) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir reads file infos under given directory

func (OSFileSystem) ReadFile

func (OSFileSystem) ReadFile(name string) ([]byte, error)

ReadFile reads whole file into byte buffer

func (OSFileSystem) Remove

func (OSFileSystem) Remove(path string) error

Remove removes a file

func (OSFileSystem) RemoveAll

func (OSFileSystem) RemoveAll(path string) error

RemoveAll removes a file and all its children

func (OSFileSystem) Stat

func (OSFileSystem) Stat(path string) (os.FileInfo, error)

Stat tries gets file info for t

type RWLocker

type RWLocker interface {
	sync.Locker
	RLock()
	RUnlock()
}

RWLocker defines the interface for a read write lock.

type ReaderSeekerCloser

type ReaderSeekerCloser interface {
	io.Reader
	io.Seeker
	io.Closer
}

ReaderSeekerCloser represents the interface that we can read, seek and close an io stream. We have define our own since there is no go built-in interface fot this.

type Reporter

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

Reporter is the the interface used to report stats,

func GetReporter

func GetReporter(tableName string, shardID int) *Reporter

GetReporter returns reporter given tableName and shardID. If the corresponding reporter cannot be found. It will return the root scope.

func GetRootReporter

func GetRootReporter() *Reporter

GetRootReporter returns the root metrics reporter.

func NewReporter

func NewReporter(rootScope tally.Scope) *Reporter

NewReporter returns a new reporter with supplied root scope.

func (*Reporter) GetChildCounter

func (r *Reporter) GetChildCounter(tags map[string]string, n MetricName) tally.Counter

GetChildCounter create tagged child counter from reporter

func (*Reporter) GetChildGauge

func (r *Reporter) GetChildGauge(tags map[string]string, n MetricName) tally.Gauge

GetChildGauge create tagged child gauge from reporter

func (*Reporter) GetChildTimer

func (r *Reporter) GetChildTimer(tags map[string]string, n MetricName) tally.Timer

GetChildTimer create tagged child timer from reporter

func (*Reporter) GetCounter

func (r *Reporter) GetCounter(n MetricName) tally.Counter

GetCounter returns the tally counter with corresponding tags.

func (*Reporter) GetGauge

func (r *Reporter) GetGauge(n MetricName) tally.Gauge

GetGauge returns the tally gauge with corresponding tags.

func (*Reporter) GetRootScope

func (r *Reporter) GetRootScope() tally.Scope

GetRootScope returns the root scope wrapped by this reporter.

func (*Reporter) GetTimer

func (r *Reporter) GetTimer(n MetricName) tally.Timer

GetTimer returns the tally timer with corresponding tags.

type ReporterFactory

type ReporterFactory struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ReporterFactory manages reporters for different table and shards. If the corresponding metrics are not associated with any table or shard. It can use the root reporter.

func NewReporterFactory

func NewReporterFactory(rootScope tally.Scope) *ReporterFactory

NewReporterFactory returns a new report factory.

func (*ReporterFactory) AddTableShard

func (f *ReporterFactory) AddTableShard(tableName string, shardID int)

AddTableShard adds a reporter for the given table and shards. It should be called when bootstrap the table shards or shard ownership changes.

func (*ReporterFactory) DeleteTableShard

func (f *ReporterFactory) DeleteTableShard(tableName string, shardID int)

DeleteTableShard deletes the reporter for the given table and shards. It should be called when the table shard no longer belongs to current node.

func (*ReporterFactory) GetReporter

func (f *ReporterFactory) GetReporter(tableName string, shardID int) *Reporter

GetReporter returns reporter given tableName and shardID. If the corresponding reporter cannot be found. It will return the root scope.

func (*ReporterFactory) GetRootReporter

func (f *ReporterFactory) GetRootReporter() *Reporter

GetRootReporter returns the root reporter.

type StackedError

type StackedError struct {
	Messages []string `json:"messages"`
	Stack    []string `json:"stack"`
}

StackedError contains multiple lines of error messages as well as the stack trace.

func StackError

func StackError(err error, message string, args ...interface{}) *StackedError

StackError adds one more line of message to err. It updates err if it's already a StackedError, otherwise creates a new StackedError with the message from err and the stack trace of current goroutine.

func (*StackedError) Error

func (e *StackedError) Error() string

type StreamDataReader

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

StreamDataReader reads primitive Golang data types from an underlying reader. It always advance the read iterator without rewinding it.

func NewStreamDataReader

func NewStreamDataReader(reader io.Reader) StreamDataReader

NewStreamDataReader returns a StreamDataReader given an underlying reader.

func (StreamDataReader) GetBytesRead

func (r StreamDataReader) GetBytesRead() uint32

GetBytesRead returns number of bytes read so far.

func (*StreamDataReader) Read

func (r *StreamDataReader) Read(bs []byte) error

Read reads bytes from underlying reader and fill bs with len(bs) bytes data. Raise error if there is no enough bytes left.

func (*StreamDataReader) ReadFloat32

func (r *StreamDataReader) ReadFloat32() (float32, error)

ReadFloat32 reads one float32 from the reader and advance.

func (*StreamDataReader) ReadInt16

func (r *StreamDataReader) ReadInt16() (int16, error)

ReadInt16 reads one int16 from the reader and advance.

func (*StreamDataReader) ReadInt32

func (r *StreamDataReader) ReadInt32() (int32, error)

ReadInt32 reads one int32 from the reader and advance.

func (*StreamDataReader) ReadInt8

func (r *StreamDataReader) ReadInt8() (int8, error)

ReadInt8 reads one int8 from the reader and advance.

func (*StreamDataReader) ReadPadding

func (r *StreamDataReader) ReadPadding(nbytes int, alignment int) error

ReadPadding reads and ignore bytes until alignment is met. nbytes is the size of bytes already read.

func (*StreamDataReader) ReadUint16

func (r *StreamDataReader) ReadUint16() (uint16, error)

ReadUint16 reads one uint16 from the reader and advance.

func (*StreamDataReader) ReadUint32

func (r *StreamDataReader) ReadUint32() (uint32, error)

ReadUint32 reads one uint32 from the reader and advance.

func (*StreamDataReader) ReadUint64

func (r *StreamDataReader) ReadUint64() (uint64, error)

ReadUint64 reads one uint64 from the reader and advance.

func (*StreamDataReader) ReadUint8

func (r *StreamDataReader) ReadUint8() (uint8, error)

ReadUint8 reads one uint8 from the reader and advance.

func (*StreamDataReader) SkipBytes

func (r *StreamDataReader) SkipBytes(nbytes int) error

SkipBytes read some empty bytes from the reader and discard it

type StreamDataWriter

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

StreamDataWriter writes primitive Golang data types to an underlying writer. It always advance the write iterator without rewinding it.

func NewStreamDataWriter

func NewStreamDataWriter(writer io.Writer) StreamDataWriter

NewStreamDataWriter returns a StreamDataWriter given an underlying writer.

func (StreamDataWriter) GetBytesWritten

func (w StreamDataWriter) GetBytesWritten() uint32

GetBytesWritten returns number of bytes written by current writer so far.

func (*StreamDataWriter) SkipBytes

func (w *StreamDataWriter) SkipBytes(nbytes int) error

SkipBytes write some empty bytes to the writer and advance.

func (*StreamDataWriter) Write

func (w *StreamDataWriter) Write(bs []byte) error

func (*StreamDataWriter) WriteFloat32

func (w *StreamDataWriter) WriteFloat32(v float32) error

WriteFloat32 writes one float32 to the writer and advance.

func (*StreamDataWriter) WriteInt16

func (w *StreamDataWriter) WriteInt16(v int16) error

WriteInt16 writes one int16 to the writer and advance.

func (*StreamDataWriter) WriteInt32

func (w *StreamDataWriter) WriteInt32(v int32) error

WriteInt32 writes one int32 to the writer and advance.

func (*StreamDataWriter) WriteInt8

func (w *StreamDataWriter) WriteInt8(v int8) error

WriteInt8 writes one int8 to the writer and advance.

func (*StreamDataWriter) WritePadding

func (w *StreamDataWriter) WritePadding(nbytes int, alignment int) error

WritePadding write some empty bytes until alignment is met. nbytes is the size of bytes already written.

func (*StreamDataWriter) WriteUint16

func (w *StreamDataWriter) WriteUint16(v uint16) error

WriteUint16 writes one uint16 to the writer and advance.

func (*StreamDataWriter) WriteUint32

func (w *StreamDataWriter) WriteUint32(v uint32) error

WriteUint32 writes one uint32 to the writer and advance.

func (*StreamDataWriter) WriteUint64

func (w *StreamDataWriter) WriteUint64(v uint64) error

WriteUint64 writes one uint64 to the writer and advance.

func (*StreamDataWriter) WriteUint8

func (w *StreamDataWriter) WriteUint8(v uint8) error

WriteUint8 writes one uint8 to the writer and advance.

type TableDataSource

type TableDataSource interface {
	NumRows() int
	GetValue(row, col int) interface{}
	ColumnHeaders() []string
}

TableDataSource defines the interface a data source need to implement so that we can render a tabular representation from the data source. We get number of columns from the length of column header. the data source itself should ensure that for each get value call with row and col within [0,numRows) and [0, numCols), it should return valid value and should not panic.

type TestingTMock

type TestingTMock struct {
}

TestingTMock is the mock class for testingT used in mockery.

func (*TestingTMock) Errorf

func (*TestingTMock) Errorf(format string, args ...interface{})

Errorf is the implementation of mockery.testingT interface.

func (*TestingTMock) FailNow

func (*TestingTMock) FailNow()

FailNow is the implementation of mockery.testingT interface.

func (*TestingTMock) Logf

func (*TestingTMock) Logf(format string, args ...interface{})

Logf is the implementation of mockery.testingT interface.

type TimeIncrementer

type TimeIncrementer struct {
	IncBySecond int64
	// contains filtered or unexported fields
}

TimeIncrementer increment current time by configurable incremental

func (*TimeIncrementer) Now

func (r *TimeIncrementer) Now() time.Time

Now increment current time by one second at a time

type Uint32Array

type Uint32Array []uint32

Uint32Array is the holder object for []uint32 and implementations for Sort interfaces.

func (Uint32Array) Len

func (s Uint32Array) Len() int

func (Uint32Array) Less

func (s Uint32Array) Less(i, j int) bool

func (Uint32Array) Swap

func (s Uint32Array) Swap(i, j int)

Directories

Path Synopsis
Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Package mocks is generated by mockery v1.0.0 Package mocks generated by mockery v1.0.0
Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Package mocks is generated by mockery v1.0.0 Package mocks generated by mockery v1.0.0

Jump to

Keyboard shortcuts

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