objectidproto

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package objectidproto builds a trogonobjectid.Definition from the trogon.object_id.v1alpha1.enum_value annotation on a protobuf enum value:

enum ObjectType {
  OBJECT_TYPE_UNSPECIFIED = 0;
  OBJECT_TYPE_TICKET = 1 [(trogon.object_id.v1alpha1.enum_value).object_type = "tkt"];
}

The object type and separator then live in one place for every language that uses the proto, and the other fields come from a base Definition:

var ticketDefinition = objectidproto.MustDefinition(acmev1.ObjectType_OBJECT_TYPE_TICKET, trogonobjectid.Definition{
	StorageFormat: trogonobjectid.FormatDropPrefix,
	Validate:      trogonobjectid.ValidateUUID,
})

type ticketType struct{}

func (ticketType) Definition() trogonobjectid.Definition { return ticketDefinition }

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Definition

Definition returns a Definition with ObjectType and Separator read from the enum value's annotation, over base. An absent separator gives trogonobjectid.DefaultSeparator. base carries the fields the annotation does not, so a new Definition field needs no change here.

func MustDefinition

MustDefinition is like Definition but panics on error. Use it in package-level variables.

Types

This section is empty.

Jump to

Keyboard shortcuts

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