testtypes

package
v0.4.79 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package testtypes defines types for testing the avro package that aren't easily defined in the test package there.

Note: stringer doesn't work on test files, and we want to make sure that enum detection works ok on stringer-generated String methods, hence the reason for this package.

Index

Constants

This section is empty.

Variables

View Source
var LabelFor_name = map[int32]string{
	0: "LABEL_FOR_ZERO",
	1: "LABEL_FOR_ONE",
	2: "LABEL_FOR_TWO",
	3: "LABEL_FOR_THREE",
}
View Source
var LabelFor_value = map[string]int32{
	"LABEL_FOR_ZERO":  0,
	"LABEL_FOR_ONE":   1,
	"LABEL_FOR_TWO":   2,
	"LABEL_FOR_THREE": 3,
}

Functions

func ProtoEnumName

func ProtoEnumName(m map[int32]string, v int32) string

ProtoEnumName is a helper function to simplify printing protocol buffer enums by name. Given an enum map and a value, it returns a useful string.

Types

type CloudEvent

type CloudEvent struct {
	Time        time.Time `json:"time"`
	Id          string    `json:"id"`
	Specversion string    `json:"specversion"`
	Source      string    `json:"source"`
	ExtraField  bool      `json:"extraField"`
}

func (CloudEvent) AvroRecord

func (CloudEvent) AvroRecord() avrotypegen.RecordInfo

AvroRecord implements the avro.AvroRecord interface.

type Enum

type Enum int
const (
	EnumOne Enum = iota
	EnumTwo
	EnumThree
)

func (Enum) String

func (i Enum) String() string

type LabelFor

type LabelFor int32

LabelFor also has a doc comment.

const (
	LabelFor_LABEL_FOR_ZERO  LabelFor = 0
	LabelFor_LABEL_FOR_ONE   LabelFor = 1
	LabelFor_LABEL_FOR_TWO   LabelFor = 2
	LabelFor_LABEL_FOR_THREE LabelFor = 3
)

func (LabelFor) EnumDescriptor

func (LabelFor) EnumDescriptor() ([]byte, []int)

func (LabelFor) String

func (x LabelFor) String() string

type Message

type Message struct {
	Metadata Metadata
}

func (Message) AvroRecord

func (Message) AvroRecord() avrotypegen.RecordInfo

AvroRecord implements the avro.AvroRecord interface.

type MessageA

type MessageA struct {
	Id                   string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Label                LabelFor `protobuf:"varint,2,opt,name=label,proto3,enum=arble.foo.v1.LabelFor" json:"label,omitempty"`
	FooUrl               string   `protobuf:"bytes,3,opt,name=foo_url,json=fooUrl,proto3" json:"foo_url,omitempty"`
	Enabled              bool     `protobuf:"varint,4,opt,name=enabled,proto3" json:"enabled,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

MessageA has a doc comment.

func (*MessageA) Descriptor

func (*MessageA) Descriptor() ([]byte, []int)

func (*MessageA) GetEnabled

func (m *MessageA) GetEnabled() bool

func (*MessageA) GetFooUrl

func (m *MessageA) GetFooUrl() string

func (*MessageA) GetId

func (m *MessageA) GetId() string

func (*MessageA) GetLabel

func (m *MessageA) GetLabel() LabelFor

func (*MessageA) ProtoMessage

func (*MessageA) ProtoMessage()

This is commented out because otherwise the logging in tests calls it, which we don't want.

func (m *MessageA) String() string {
	return proto.CompactTextString(m)
}

func (*MessageA) Reset

func (m *MessageA) Reset()

func (*MessageA) XXX_DiscardUnknown

func (m *MessageA) XXX_DiscardUnknown()

func (*MessageA) XXX_Marshal

func (m *MessageA) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MessageA) XXX_Merge

func (m *MessageA) XXX_Merge(src ProtoMessage)

func (*MessageA) XXX_Size

func (m *MessageA) XXX_Size() int

func (*MessageA) XXX_Unmarshal

func (m *MessageA) XXX_Unmarshal(b []byte) error

type MessageB

type MessageB struct {
	Arble                *MessageA `protobuf:"bytes,1,opt,name=arble,proto3" json:"arble,omitempty"`
	Selected             bool      `protobuf:"varint,2,opt,name=selected,proto3" json:"selected,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

UserDisability is used to show whether a disability has been selected by a user.

func (*MessageB) Descriptor

func (*MessageB) Descriptor() ([]byte, []int)

func (*MessageB) GetArble

func (m *MessageB) GetArble() *MessageA

func (*MessageB) GetSelected

func (m *MessageB) GetSelected() bool

func (*MessageB) ProtoMessage

func (*MessageB) ProtoMessage()

This is commented out because otherwise the logging in tests calls it, which we don't want.

func (m *MessageB) String() string {
	return proto.CompactTextString(m)
}

func (*MessageB) Reset

func (m *MessageB) Reset()

func (*MessageB) XXX_DiscardUnknown

func (m *MessageB) XXX_DiscardUnknown()

func (*MessageB) XXX_Marshal

func (m *MessageB) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MessageB) XXX_Merge

func (m *MessageB) XXX_Merge(src ProtoMessage)

func (*MessageB) XXX_Size

func (m *MessageB) XXX_Size() int

func (*MessageB) XXX_Unmarshal

func (m *MessageB) XXX_Unmarshal(b []byte) error

type Metadata

type Metadata struct {
	CloudEvent CloudEvent
}

func (Metadata) AvroRecord

func (Metadata) AvroRecord() avrotypegen.RecordInfo

AvroRecord implements the avro.AvroRecord interface.

type ProtoMessage

type ProtoMessage struct{}

Jump to

Keyboard shortcuts

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