graphapi

package
v0.0.0-...-6899a91 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandlerFindAllActive

func HandlerFindAllActive(repository Repository) gin.HandlerFunc

HandlerFindAllActive returns a resource list

Types

type Edge

type Edge struct {
	ID         string      `json:"id"`
	From       string      `json:"from"`
	To         string      `json:"to"`
	Type       string      `json:"type"`
	Properties interface{} `json:"properties"`
}

Edge define a edge resource

func (*Edge) GetFrom

func (e *Edge) GetFrom() string

GetFrom get edge entity

func (*Edge) GetID

func (e *Edge) GetID() string

GetID get edge entity

func (*Edge) GetProperties

func (e *Edge) GetProperties() interface{}

GetProperties get edge entity

func (*Edge) GetTo

func (e *Edge) GetTo() string

GetTo get edge entity

func (*Edge) GetType

func (e *Edge) GetType() string

GetType get edge type

type Graph

type Graph struct {
	Nodes []Node `json:"nodes"`
	Edges []Edge `json:"edges"`
}

Graph define a graph resource

type ImplementEdge

type ImplementEdge interface {
	GetID() string
	GetFrom() string
	GetTo() string
	GetType() string
	GetProperties() interface{}
}

ImplementEdge defines and identifiable node entity

type ImplementNode

type ImplementNode interface {
	GetID() string
	GetName() string
	GetType() string
	GetEdges() []ImplementEdge
}

ImplementNode define an entity which can have dependencies

func Convert

func Convert(repo Repository, entities []interface{}) []ImplementNode

Convert to dependencies node behaviour

type ImplementsGraph

type ImplementsGraph interface {
}

ImplementsGraph defines and identifiable node entity

type Node

type Node struct {
	ID         string      `json:"id"`
	Name       string      `json:"name"`
	Type       string      `json:"type"`
	Properties interface{} `json:"properties"`
}

Node define a node resource

func (*Node) GetID

func (n *Node) GetID() string

GetID get source entity

func (*Node) GetName

func (n *Node) GetName() string

GetName get name

func (*Node) GetType

func (n *Node) GetType() string

GetType get name

type Repository

type Repository interface {
	FindAll() (*Graph, error)
	FindAllActive(map[string]interface{}) (*Graph, error)
	GetType() reflect.Type
	// Map api entity to graph entity
	Map(entity interface{}, others map[string]ImplementNode) ImplementNode
	// Resolve entity dependencies
	Resolve(entity interface{}, mappers map[string]ImplementNode)
}

Repository defines a normal repository

Source Files

  • graph.go
  • type.go

Jump to

Keyboard shortcuts

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