util

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BqPrefix for internal dataset.
	BqPrefix = "google.com:"
	// BtProject is the GCP project containing the BigTable instance
	BtProject = "google.com:datcom-store-dev"
	// BtInstance for internal cache instance.
	BtInstance = "prophet-cache"
	// BtTable for internal table.
	BtTable = "dc9"
	// BtPropValInPrefix for internal GetPropertyValues in arc cache.
	BtPropValInPrefix = "d/0/"
	// BtPropValOutPrefix for internal GetPropertyValues out arc cache.
	BtPropValOutPrefix = "d/1/"
	// BtPopObsPrefix for internal pop obs cache.
	BtPopObsPrefix = "d/2/"
	// BtPlaceObsPrefix for internal place obs cache.
	BtPlaceObsPrefix = "d/3/"
	// BtPlaceKMLPrefix for internal place KML coordinates cache.
	BtPlaceKMLPrefix = "d/6/"
	// BtTriplesPrefix for internal GetTriples cache.
	BtTriplesPrefix = "d/7/"
	// BtArcsPrefix for internal arcs cache.
	BtArcsPrefix = "d/9/"
	// BtPopPrefix for population cache.
	BtPopPrefix = "d/a/"
	// BtObsPrefix for observation cache.
	BtObsPrefix = "d/b/"
	// BtFamily is the key for the row.
	BtFamily = "csv"
	// BtCacheLimit is the cache limit. The limit is per predicate and neighbor type.
	BtCacheLimit = 200
	// BtBatchQuerySize is the size of BigTable batch query.
	BtBatchQuerySize = 1000
	// LimitFactor is the amount to multiply the limit by to make sure certain
	// triples are returned by the BQ query.
	LimitFactor = 1
	// TextType represents text type.
	TextType = "Text"
)

Variables

This section is empty.

Functions

func BigTableReadRowsParallel

func BigTableReadRowsParallel(ctx context.Context, btClient *bigtable.Client,
	rowSet bigtable.RowSet, action func(row bigtable.Row) error) error

BigTableReadRowsParallel reads BigTable rows in parallel, considering the size limit for RowSet is 500KB.

func CamelToSnake

func CamelToSnake(str string) string

CamelToSnake converts a camel case string to snake case string.

func GetContainedIn

func GetContainedIn(typeRelationJSONFilePath string) (map[TypePair][]string, error)

GetContainedIn returns the contained in relation change given two types.

func GetProjectID

func GetProjectID(db string) (string, error)

GetProjectID gets the bigquery project id based on dataset name.

func IterateSortPVs

func IterateSortPVs(pvs []*pb.PropertyValue, action func(i int, p, v string))

IterateSortPVs iterates a list of PVs and performs actions on them.

func SnakeToCamel

func SnakeToCamel(s string) string

SnakeToCamel converts a snake case string to camel case string.

func StringContainedIn

func StringContainedIn(target string, strs []string) bool

StringContainedIn returns true if TARGET is contained in STRS

func StringList

func StringList(strs []string) string

StringList formats a list of strings into a comma-separated list with each surrounded with quotes.

func UnzipAndDecode

func UnzipAndDecode(contents string) ([]byte, error)

UnzipAndDecode decompresses the given contents using gzip and decodes it from base64

func ZipAndEncode

func ZipAndEncode(contents string) (string, error)

ZipAndEncode Compresses the given contents using gzip and encodes it in base64

Types

type TypePair

type TypePair struct {
	Child  string
	Parent string
}

TypePair represents two types that are related.

Jump to

Keyboard shortcuts

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