conv

package
v0.0.0-...-6719cd2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package conv helps convert between related types as an update request is processed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ParserToLog

type ParserToLog struct {
	// Maps from external IDs to KID or offset.
	ExternalIDs map[string]logentry.KIDOrOffset
	// Maps from variable names to KID or offset.
	Variables map[string]logentry.KIDOrOffset
}

ParserToLog converts fields from parser.Insert into logentry values.

func (*ParserToLog) MustKGObject

func (converter *ParserToLog) MustKGObject(term parser.Term) logentry.KGObject

MustKGObject returns a non-zero value or panics. It panics if a necessary external ID or variable doesn't have a KIDorOffset value.

func (*ParserToLog) MustKIDOrOffset

func (converter *ParserToLog) MustKIDOrOffset(term parser.Term) logentry.KIDOrOffset

MustKIDOrOffset returns a non-zero value or panics. It panics if a necessary external ID or variable doesn't have a KIDorOffset value.

type ParserToRPC

type ParserToRPC struct {
	// Maps from external IDs to KIDs. Values of 0 are equivalent to missing
	// keys.
	ExternalIDs map[string]uint64
	// Maps from variable names to KIDs. Values of 0 are equivalent to missing
	// keys.
	Variables map[string]uint64
}

ParserToRPC converts fields from parser.Insert into RPC values.

func (*ParserToRPC) KGObject

func (converter *ParserToRPC) KGObject(term parser.Term) (rpc.KGObject, bool)

KGObject returns a non-empty KGObject and true if the term is convertible to a KGObject. Otherwise, it returns a zero KGObject and false.

func (*ParserToRPC) KID

func (converter *ParserToRPC) KID(term parser.Term) (uint64, bool)

KID returns a non-zero value and true if the term is convertible to a KID. Otherwise, it returns 0 and false.

Jump to

Keyboard shortcuts

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