patch

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

Action defines action of document patch.

const (

	// Replace captures enum value "replace".
	Replace Action = "replace"

	// AddPublicKeys captures enum value "add-public-keys".
	AddPublicKeys Action = "add-public-keys"

	// RemovePublicKeys captures enum value "remove-public-keys".
	RemovePublicKeys Action = "remove-public-keys"

	// AddServiceEndpoints captures "add-services".
	AddServiceEndpoints Action = "add-services"

	// RemoveServiceEndpoints captures "remove-services".
	RemoveServiceEndpoints Action = "remove-services"

	// JSONPatch captures enum value "json-patch".
	JSONPatch Action = "ietf-json-patch"

	// AddAlsoKnownAs captures "add-also-known-as".
	AddAlsoKnownAs Action = "add-also-known-as"

	// RemoveAlsoKnownAs captures "remove-also-known-as".
	RemoveAlsoKnownAs Action = "remove-also-known-as"
)

type Key

type Key string

Key defines key that will be used to get document patch information.

const (

	// DocumentKey captures  "document" key.
	DocumentKey Key = "document"

	// PatchesKey captures "patches" key.
	PatchesKey Key = "patches"

	// PublicKeys captures "publicKeys" key.
	PublicKeys Key = "publicKeys"

	// ServicesKey captures "services" key.
	ServicesKey Key = "services"

	// IdsKey captures "ids" key.
	IdsKey Key = "ids"

	// ActionKey captures "action" key.
	ActionKey Key = "action"

	// UrisKey captures "uris" key.
	UrisKey Key = "uris"
)

type Patch

type Patch map[Key]interface{}

Patch defines generic patch structure.

func FromBytes

func FromBytes(data []byte) (Patch, error)

FromBytes parses provided data into document patch.

func NewAddAlsoKnownAs

func NewAddAlsoKnownAs(uris string) (Patch, error)

NewAddAlsoKnownAs creates new patch for adding also-known-as property.

func NewAddPublicKeysPatch

func NewAddPublicKeysPatch(publicKeys string) (Patch, error)

NewAddPublicKeysPatch creates new patch for adding public keys.

func NewAddServiceEndpointsPatch

func NewAddServiceEndpointsPatch(serviceEndpoints string) (Patch, error)

NewAddServiceEndpointsPatch creates new patch for adding service endpoints.

func NewJSONPatch

func NewJSONPatch(patches string) (Patch, error)

NewJSONPatch creates new generic update patch (will be used for generic updates).

func NewRemoveAlsoKnownAs

func NewRemoveAlsoKnownAs(uris string) (Patch, error)

NewRemoveAlsoKnownAs creates new patch for removing also-known-as URI.

func NewRemovePublicKeysPatch

func NewRemovePublicKeysPatch(publicKeyIds string) (Patch, error)

NewRemovePublicKeysPatch creates new patch for removing public keys.

func NewRemoveServiceEndpointsPatch

func NewRemoveServiceEndpointsPatch(serviceEndpointIds string) (Patch, error)

NewRemoveServiceEndpointsPatch creates new patch for removing service endpoints.

func NewReplacePatch

func NewReplacePatch(doc string) (Patch, error)

NewReplacePatch creates new replace patch.

func PatchesFromDocument

func PatchesFromDocument(doc string) ([]Patch, error)

PatchesFromDocument creates patches from opaque document.

func (Patch) Bytes

func (p Patch) Bytes() ([]byte, error)

Bytes returns byte representation of patch.

func (Patch) GetAction

func (p Patch) GetAction() (Action, error)

GetAction returns string value for specified key or "" if not found or wrong type.

func (Patch) GetValue

func (p Patch) GetValue() (interface{}, error)

GetValue returns patch value.

func (Patch) JSONLdObject

func (p Patch) JSONLdObject() map[Key]interface{}

JSONLdObject returns map that represents JSON LD Object.

Jump to

Keyboard shortcuts

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