identitypb

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package identitypb provides the "well-known" Identity type for representing application and handler (etc) identifies as Protocol Buffers messages.

Index

Constants

This section is empty.

Variables

View Source
var File_github_com_dogmatiq_enginekit_protobuf_identitypb_identity_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Identity

type Identity struct {

	// Name is the entity's human-readable name.
	//
	// The name should be unique enough to allow a human to identify the entity
	// without ambiguity. There is no hard requirement for uniqueness.
	//
	// Entity names may be changed at any time.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Key is the entity's immutable, unique key.
	//
	// The key is used to uniquely identify the entity globally, and across all
	// time. Every entity must have its own UUID, which must not be changed.
	Key *uuidpb.UUID `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

Identity represents the identity of an entity.

It is used to identify Dogma applications, handlers, sites, streams, etc.

func New

func New(name string, key *uuidpb.UUID) *Identity

New returns a new identity with the given name and key.

func (*Identity) Descriptor deprecated

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

Deprecated: Use Identity.ProtoReflect.Descriptor instead.

func (*Identity) Format

func (x *Identity) Format(f fmt.State, verb rune)

Format implements the fmt.Formatter interface, allowing UUIDs to be formatted with functions from the fmt package.

func (*Identity) GetKey

func (x *Identity) GetKey() *uuidpb.UUID

func (*Identity) GetName

func (x *Identity) GetName() string

func (*Identity) ProtoMessage

func (*Identity) ProtoMessage()

func (*Identity) ProtoReflect

func (x *Identity) ProtoReflect() protoreflect.Message

func (*Identity) Reset

func (x *Identity) Reset()

func (*Identity) SetKey

func (x *Identity) SetKey(v *uuidpb.UUID)

SetKey sets the x.Key field to v, then returns x.

func (*Identity) SetName

func (x *Identity) SetName(v string)

SetName sets the x.Name field to v, then returns x.

func (*Identity) String

func (x *Identity) String() string

func (*Identity) Validate

func (x *Identity) Validate() error

Validate returns an error if x is invalid.

It does not perform UTF-8 validation on the name. This should be validated by the engine when the identity is configured.

type IdentityBuilder

type IdentityBuilder struct {
	// contains filtered or unexported fields
}

func NewIdentityBuilder

func NewIdentityBuilder() *IdentityBuilder

NewIdentityBuilder returns a builder that constructs Identity messages.

func (*IdentityBuilder) Build

func (b *IdentityBuilder) Build() *Identity

Build returns a new Identity containing the values configured via the builder.

Each call returns a new message, such that future changes to the builder do not modify previously constructed messages.

func (*IdentityBuilder) From

From configures the builder to use x as the prototype for new messages, then returns b.

It performs a shallow copy of x, such that any changes made via the builder do not modify x. It does not make a copy of the field values themselves.

func (*IdentityBuilder) WithKey

func (b *IdentityBuilder) WithKey(v *uuidpb.UUID) *IdentityBuilder

WithKey configures the builder to set the Key field to v, then returns b.

func (*IdentityBuilder) WithName

func (b *IdentityBuilder) WithName(v string) *IdentityBuilder

WithName configures the builder to set the Name field to v, then returns b.

Jump to

Keyboard shortcuts

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