norm

package module
v0.0.0-...-368b0bc Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2015 License: MIT Imports: 3 Imported by: 0

README

norm

GoDoc Build Status

Neoism is agreat client for neo4j. However if you are doing some basic CRUD stuff with neo4j you end up writing code that is repeating itself a lot. I think this sucks, So I will try to implement a very basic ORM.

Planned features

  • Save and Load a basic node which represents a struct without relationship and a label
  • Define Relationships of a node
  • Load Relationships and related nodes.
  • Limits, Offsets
  • Somehow an ability to write a custom cypher query to do crazy shit, but serialize the results into the previously defined structs

Documentation

Overview

Package norm please refer to the README on my github project for now: https://github.com/wwwdata/norm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

A Database connects to neo4j and initiates all further queries

func Connect

func Connect(url string) (database Database, err error)

Connect to a neo4j database

func (Database) CreateNode

func (d Database) CreateNode(obj Label) *Query

CreateNode creates a new node with all fields from a struct that implements the `Label` interface

func (Database) ExecuteCypher

func (d Database) ExecuteCypher(cypher string) error

ExecuteCypher executes a raw cypher query

func (Database) FindNodes

func (d Database) FindNodes(label string, destination interface{}) *Query

FindNodes finds all nodes with a given label and scans the results into destination

type Label

type Label interface {
	GetLabel() string
}

The Label interface must be implemented for every struct and defines the neo4j label name

type Query

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

The Query object which constructs all the magic. Do not instantiate this directly, there is a chainable api for everything!

func (*Query) Commit

func (q *Query) Commit() error

Commit executes the defined steps of the chainable api before

func (*Query) GetLastID

func (q *Query) GetLastID() int

GetLastID returns the internal neo4j ID of the last generated node. This should not be interesting, because the IDs in neo4j are always different if you restart it. If a node could not be created, you will notice it by an error

Jump to

Keyboard shortcuts

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