bqproto

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

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

Go to latest
Published: Apr 23, 2023 License: MIT Imports: 14 Imported by: 0

README

BQProto

bqproto is the library for encoding Go Struct to Protocol Buffers message without a definition.

Usage

var schema bigquery.Schema

type Row struct {
	Str string  `bigquery:"str"`
	Int integer `bigquery:"int"`
}

func example() {
	row := Row {
		Str: "日本語",
		Int: 123,
	}
	
	b1, err := bqproto.MarshalForSchema(schema, &row)
	if err != nil {
		log.Fatal(err)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MaxDecimal big.Rat
	MinDecimal big.Rat
)
View Source
var (
	ErrMissingRequired = fmt.Errorf("missing required field")
	ErrExistsHindrance = fmt.Errorf("exists hindrance field")
)

Functions

func MarshalForSchema

func MarshalForSchema(schema bigquery.Schema, v any, opts ...Option) ([]byte, error)

func SchemaDescriptorProto

func SchemaDescriptorProto(project, dataset, table string) (bigquery.Schema, *descriptorpb.DescriptorProto, error)

func ValidateSchemaCompatibility

func ValidateSchemaCompatibility(tableSchema bigquery.Schema, v any, opts ...Option) error

Types

type Option

type Option func(*option)

func WithFractionalTime

func WithFractionalTime() Option

func WithTagKey

func WithTagKey(s string) Option

Jump to

Keyboard shortcuts

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