crud

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2025 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Overview

Foliage graph store crud package. Provides stateful functions of low-level crud operations for the graph store

Index

Constants

View Source
const (
	KeySuff1Pattern = "%s"
	KeySuff2Pattern = "%s.%s"
	KeySuff3Pattern = "%s.%s.%s"
	KeySuff4Pattern = "%s.%s.%s.%s"

	// key=fmt.Sprintf(BodyValueIndexPrefPattern+KeySuff2Pattern, <vertexId>, <bodyKeyName>, <valueType>), value=<bodyKeyValue>
	VertexBodyValueIndexPrefPattern = "%s.body.index."

	// key=fmt.Sprintf(BodyValueIndexPrefPattern+KeySuff3Pattern, <fromVertexId>, <linkName>, <bodyKeyName>, <valueType>), value=<bodyKeyValue>
	LinkBodyValueIndexPrefPattern = "%s.out.body.index."

	// key=fmt.Sprintf(OutLinkBodyKeyPrefPattern+KeySuff1Pattern, <fromVertexId>, <linkName>), value=<linkType.toVertexId>
	OutLinkTargetKeyPrefPattern = "%s.out.to."

	// key=fmt.Sprintf(OutLinkBodyKeyPrefPattern+KeySuff2Pattern, <fromVertexId>, <linkName>), value=<linkBody>
	OutLinkBodyKeyPrefPattern = "%s.out.body."

	// key=fmt.Sprintf(OutLinkBodyKeyPrefPattern+KeySuff2Pattern, <fromVertexId>, <linkType>, <toVertexId>), value=<linkName>
	OutLinkTypeKeyPrefPattern = "%s.ltype."

	// key=fmt.Sprintf(OutLinkIndexPrefPattern+KeySuff3Pattern, <fromVertexId>, <linkName>, <index_name>, <value>), value=nil
	OutLinkIndexPrefPattern = "%s.out.index."
	// key=fmt.Sprintf(InLinkKeyPrefPattern+KeySuff2Pattern, <toVertexId>, <fromVertexId>, <linkName>), value=linkType
	InLinkKeyPrefPattern = "%s.in."
)
View Source
const (
	OBJECTS_TYPELINK = "__objects"
	TYPES_TYPELINK   = "__types"
	TO_TYPELINK      = "__type"
	OBJECT_TYPELINK  = "__object"

	GROUP_TYPELINK = "group"

	BUILT_IN_TYPES      = "types"
	BUILT_IN_OBJECTS    = "objects"
	BUILT_IN_ROOT       = "root"
	BUILT_IN_TYPE_GROUP = "group"
	BUILT_IN_OBJECT_NAV = "nav"
)

Variables

This section is empty.

Functions

func CreateObject added in v0.1.3

{
	"origin_type": string
	"body": json
}
{
	"to": string,
	"name": string, // optional, "to" will be used if not defined
	"body": json
	"tags": []string
}

create object -> object link

func CreateType added in v0.1.3

{
	"body": json
}
{
	"to": string
	"object_type": string
	"body": json
	"tags": []string
}

create type -> type link

func DeleteObject added in v0.1.3

func DeleteObjectFilteredOutLinksStatefun added in v0.1.6

func DeleteObjectFilteredOutLinksStatefun(_ sfPlugins.StatefunExecutor, ctx *sfPlugins.StatefunContextProcessor)

payload: json - required

link_type: string - required
to_object_type: string - required

options: json - optional

op_stack: bool - optional
{
	"to": string,
}

func DeleteType added in v0.1.3

{
	"to": string
}

func LLAPILinkCreate

Creates a link.

Request:

payload: json - required
	// Initial request from caller:
	force: bool - optional // Creates even if already exists
	to: string - required // ID for descendant vertex.
	name: string - required // Defines link's name which is unique among all vertex's output links.
	type: string - required // Type of link leading to descendant.
	tags: []string - optional // Defines link tags.
	body: json - optional // Body for link leading to descendant.
		<key>: <type> - optional // Any additional key and value to be stored in link's body.

	// Self-requests to descendants (RequestReply): // ID can be composite: <object_id>===self_link - for non-blocking execution on the same vertex
		in_name: string - required // Creating input link's name

options: json - optional
	op_stack: bool - optional

Reply:

payload: json
	status: string
	details: string
	data: json
		op_stack: json array - optional

func LLAPILinkDelete

Delete a link.

Request:

payload: json - required
	// Initial request from caller:
	name: string - required // Defines link's name which is unique among all vertex's output links.

	to: string - required if "name" is not defined // ID for descendant vertex.
	type: string - required if "name" is not defined // Type of link leading to descendant.

	// Self-requests to descendants (RequestReply): // ID can be composite: <object_id>===self_link - for non-blocking execution on the same vertex
	in_name: string - required // Deleting input link's name

options: json - optional
	op_stack: bool - optional

Reply:

payload: json
	status: string
	details: string
	data: json
		op_stack: json array - optional

func LLAPILinkRead added in v0.1.6

Reads and returns link's body.

Request:

payload: json - required
	// Initial request from caller:
	name: string - required // Defines link's name which is unique among all vertex's output links.

	to: string - required if "name" is not defined // ID for descendant vertex.
	type: string - required if "name" is not defined // Type of link leading to descendant.

	details: bool - optional // "false" - (default) only body will be returned, "true" - body and info will be returned

options: json - optional
	op_stack: bool - optional

Reply:

payload: json
	status: string
	details: string
	data: json
		body: json // link's body
		name: string - optional // link's name
		type: string - optional // link's type
		tags: string array - optional // link's tags
		from: string - optional // link goes out from vertex id
		to: string - optional // link goes into vertex id
		op_stack: json array - optional

func LLAPILinkUpdate

Updates a link.

Request:

payload: json - required
	name: string - required if "to" or "type" is not defined. required if "upsert" is set to "true" // Defines link's name which is unique among all vertex's output links.

	to: string - required if "name" is not defined. required if "upsert" is set to "true" // ID for descendant vertex.
	type: string - required if "name" is not defined. required if "upsert" is set to "true" // Type of link leading to descendant.

	tags: []string - optional // Defines link tags.
	upsert: bool // "false" - (default), "true" - will create link if does not exist
	replace: bool - optional // "false" - (default) body and tags will be merged, "true" - body and tags will be replaced
	body: json - optional // Body for link leading to descendant.
		<key>: <type> - optional // Any additional key and value to be stored in link's body.

options: json - optional
	op_stack: bool - optional

Reply:

payload: json
	status: string
	details: string
	data: json
		op_stack: json array - optional

func LLAPIVertexCreate added in v0.1.3

Creates a vertex in the graph with an id the function being called with.

Request:

payload: json - optional
	// Initial request from caller:
	body: json - optional // Body for vertex to be created with.
		<key>: <type> - optional // Any additional key and value to be stored in objects's body.

options: json - optional
	op_stack: bool - optional

Reply:

payload: json
	status: string
	details: string
	data: json
		op_stack: json array - optional

func LLAPIVertexDelete added in v0.1.3

Deletes a vartex with an id the function being called with from the graph and deletes all links related to it.

Request:

options: json - optional
	op_stack: bool - optional

Reply:

payload: json
	status: string
	details: string
	data: json
		op_stack: json array - optional

func LLAPIVertexRead added in v0.1.6

Reads and returns vertice's body.

Request:

payload: json - optional
	details: bool - optional // "false" - (default) only body will be returned, "true" - body and links info will be returned

options: json - optional
	op_stack: bool - optional

Reply:

payload: json
	status: string
	details: string
	data: json
		body: json // Vertice's body
		links: json - optional // Vertice's links
			out: json
				names: json string array
				types: json string array
				ids: json string array
			in: json string array
				{from: string, name: string}, // from vertex id; link name
				...
		op_stack: json array - optional

func LLAPIVertexUpdate added in v0.1.3

Updates a vertex in the graph with an id the function being called with. Merges or replaces the old vertice's body with the new one.

Request:

payload: json - optional
	body: json - optional // Body for vertex to be created with.
		<key>: <type> - optional // Any additional key and value to be stored in vertex's body.
	upsert: bool // "false" - (default), "true" - will create vertex if does not exist
	replace: bool - optional // "false" - (default) body and tags will be merged, "true" - body and tags will be replaced

options: json - optional
	op_stack: bool - optional

Reply:

payload: json
	status: string
	details: string
	data: json
		op_stack: json array - optional

func ReadObject added in v0.1.6

{
	"to": string
}

func ReadType added in v0.1.6

{
	"to": string
}

func RegisterAllFunctionTypes

func RegisterAllFunctionTypes(runtime *statefun.Runtime)

func UpdateObject added in v0.1.3

{
	"origin_type": string, not requred! required only if "upsert"==true
	"upsert": bool - optional, default: false
	"replace": bool - optional, default: false
	"body": json
}
{
	"to": string
	"name": string, // not needed, required if "upsert" is true
	"body": json
	"tags": []string
	"upsert": bool
	"replace": bool
}

func UpdateType added in v0.1.3

{
	"upsert": bool - optional, default: false
	"replace": bool - optional, default: false
	"body": json
}
{
	"to": string,
	"body": json, optional
	"tags": []string
	"upsert": bool
	"replace": bool
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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