identity

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package identity 定义 Pinax durable vault object 的稳定身份合同。

Index

Constants

This section is empty.

Variables

View Source
var ErrIdempotencyKeyRequired = errors.New("identity_idempotency_key_required")

Functions

func LegacyNoteIDFromPath

func LegacyNoteIDFromPath(path string) string

LegacyNoteIDFromPath 仅用于读取和迁移尚未拥有 canonical UUID 的旧笔记。 新对象创建、复制、移动和重命名不得调用此函数。

func UnixMillis

func UnixMillis(id ObjectID) (int64, error)

Types

type Allocator

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

func NewAllocator

func NewAllocator() *Allocator

func NewAllocatorWithGenerator

func NewAllocatorWithGenerator(generate Generator) *Allocator

func (*Allocator) Allocate

func (allocator *Allocator) Allocate(idempotencyKey string) (ObjectID, error)

type Generator

type Generator func() (ObjectID, error)

type IDClass

type IDClass string
const (
	IDClassInvalid   IDClass = "invalid"
	IDClassCanonical IDClass = "canonical"
	IDClassLegacy    IDClass = "legacy"
)

func Classify

func Classify(raw string) IDClass

type ObjectID

type ObjectID string

func MustParseObjectID

func MustParseObjectID(raw string) ObjectID

func NewObjectID

func NewObjectID() (ObjectID, error)

func ParseObjectID

func ParseObjectID(raw string) (ObjectID, error)

func (ObjectID) String

func (id ObjectID) String() string

type ObjectKind

type ObjectKind string
const (
	KindVault      ObjectKind = "vault"
	KindNote       ObjectKind = "note"
	KindAsset      ObjectKind = "asset"
	KindProject    ObjectKind = "project"
	KindSubproject ObjectKind = "subproject"
	KindFolder     ObjectKind = "folder"
	KindView       ObjectKind = "view"
	KindTemplate   ObjectKind = "template"
	KindTask       ObjectKind = "task"
	KindFile       ObjectKind = "file"
)

func (ObjectKind) Valid

func (kind ObjectKind) Valid() bool

Jump to

Keyboard shortcuts

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