memgraph

package
v0.0.0-...-877557f Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RelationshipTypes = []string{
	"Parent",
	"Child",
	"Spouse",
	"Sibling",
}

Functions

func EscapeString

func EscapeString(s string) string

EscapeString escapes delimiters in a string to prevent cypher injection

func InitDatabase

func InitDatabase(dbURI, dbUser, dbPassword string) neo4j.DriverWithContext

func VerifyString

func VerifyString(s string) error

VerifyString verifies if a string is valid and does not contain cypher injection

Types

type Person

type Person struct {
	ID                  string              `json:"id"`
	Firstname           string              `json:"first_name"`
	Middlename          string              `json:"middle_name"`
	Lastname            string              `json:"last_name"`
	Titles              []string            `json:"titles"`   // e.g. Jr., Sr., III
	Suffixes            []string            `json:"suffixes"` // e.g. Ph.D., M.D.
	ExtraNames          []string            `json:"extra_names"`
	Aliases             []string            `json:"aliases"`
	MothersFirstname    string              `json:"mothers_first_name"`
	MothersLastname     string              `json:"mothers_last_name"`
	Born                time.Time           `json:"born"`
	Birthplace          string              `json:"birthplace"`
	Residence           string              `json:"residence"`
	Death               time.Time           `json:"death"`
	Deathplace          string              `json:"deathplace"`
	LifeEvents          []map[string]string `json:"life_events"`
	Occupations         []string            `json:"occupation"`
	OccupationToDisplay string              `json:"occupation_to_display"`
	OthersSaid          map[string]string   `json:"others_said"`
	Photos              map[string]string   `json:"photos"`
	ProfilePicture      string              `json:"profile_picture"`
	// contains filtered or unexported fields
}

func (*Person) CreatePerson

func (p *Person) CreatePerson(driver neo4j.DriverWithContext) (*neo4j.Record, error)

func (*Person) DeletePerson

func (p *Person) DeletePerson(driver neo4j.DriverWithContext) error

func (*Person) ToString

func (p *Person) ToString() string

func (*Person) UpdatePerson

func (p *Person) UpdatePerson(driver neo4j.DriverWithContext) (*neo4j.Record, error)

func (*Person) Verify

func (p *Person) Verify() error

Verify checks if the person is valid and does not contain cypher injection it also escapes the delimiters contained in any of the strings

type Relationship

type Relationship struct {
	FirstPersonID  string `json:"first_person_id"`
	SecondPersonID string `json:"second_person_id"`
	Relationship   string `json:"relationship"`
	Direction      string `json:"direction"`
}

func (*Relationship) CreateRelationship

func (r *Relationship) CreateRelationship(driver neo4j.DriverWithContext) (*neo4j.Record, error)

func (*Relationship) DeleteRelationship

func (r *Relationship) DeleteRelationship(driver neo4j.DriverWithContext) error

func (*Relationship) Verify

func (r *Relationship) Verify() error

Verify checks if the relationship is valid and does not contain cypher injection

func (*Relationship) VerifyRelationship

func (r *Relationship) VerifyRelationship(driver neo4j.DriverWithContext) (*neo4j.Record, error)

type RelationshipAndPerson

type RelationshipAndPerson struct {
	Relationship Relationship `json:"relationship"`
	Person       Person       `json:"person"`
}

func (*RelationshipAndPerson) CreateRelationshipAndPerson

func (rp *RelationshipAndPerson) CreateRelationshipAndPerson(driver neo4j.DriverWithContext) (*neo4j.Record, error)

func (*RelationshipAndPerson) Verify

func (r *RelationshipAndPerson) Verify() error

Jump to

Keyboard shortcuts

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