csvtoprotoparse

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: Apache-2.0, BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package csvtoprotoparse contains runtime functionality needed by code generated by the go/csv-to-proto tool.

These functions are not intended to be used outside of generated code "unless you know what you're doing."

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DurationToDurationProto added in v0.0.7

func DurationToDurationProto(d time.Duration) (*dpb.Duration, error)

DurationToDurationProto returns a Duration proto from a time.Duration value that may be nil.

func MustLoadLocation added in v0.0.6

func MustLoadLocation(name string) *time.Location

MustLoadLocation returns a time.Location or panics.

func ParseDouble

func ParseDouble(rawValue string) (float64, error)

ParseDouble returns a double from a CSV field.

func ParseDuration added in v0.0.7

func ParseDuration(rawValue, unit string) (*dpb.Duration, error)

ParseDuration returns a proto version of a duration, using an option unit suffix.

func ParseFloat

func ParseFloat(rawValue string) (float32, error)

ParseFloat returns a float from a CSV field.

func ParseInt32

func ParseInt32(rawValue string) (int32, error)

ParseInt32 returns an int32 parsed from a CSV field.

func ParseInt64

func ParseInt64(rawValue string) (int64, error)

ParseInt64 returns an int64 from a CSV field.

func ParseString

func ParseString(rawValue string) (string, error)

ParseString parses a string value from a CSV field.

This function has a strange signature for the convenience of the generated code. It always returns its first argument and never returns an error.

func ParseTimestamp

func ParseTimestamp(rawValue, layout string, timezone string) (*ts.Timestamp, error)

ParseTimestamp returns a proto version of a timestamp using a given layout.

func TimeToTimestamp added in v0.0.6

func TimeToTimestamp(t time.Time) (*ts.Timestamp, error)

TimeToTimestamp returns a Timestamp proto from a time value that may be nil.

Types

type ReaderOption

type ReaderOption interface{}

ReaderOption is used to specify a custom argument to csvtoproto readers at construction time.

Jump to

Keyboard shortcuts

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