Skip to content

Instantly share code, notes, and snippets.

@CoderPuppy
Last active January 2, 2016 23:39
Show Gist options
  • Save CoderPuppy/8378104 to your computer and use it in GitHub Desktop.
Save CoderPuppy/8378104 to your computer and use it in GitHub Desktop.
New idea for DDB

cyphernet

cells are just data; the id is the hash of the data; thus you can't change the data

An imaginary orm based on what I read on cyphernet:

// Author
{
	_links: [ 'type' ],
	type: Author.id,
	name: 'CoderPuppy'
}

// Post
{
	_links: [ 'type', 'author' ],
	type: Post.id,
	author: author.id,
	content: 'DO NOT POST "foobarbaz"'
}

// Comment
{
	_links: [ 'type', 'post', 'author' ],
	type: Comment.id,
	author: author.id,
	post: post.id,
	content: 'I\'m posting "foobarbaz"'
}

The DDB way:

// Author
{
	_links: {
		type: TypeAssoc.id
	},
	type: Author.id
	name: 'CoderPuppy'
}

// Post
{
	_links: {
		type: TypeAssoc.id,
		author: WrittenByAssoc.id
	},
	type: Post.id,
	author: author.id,
	content: 'DO NOT POST "foobarbaz"'
}

// Comment
{
	_links: {
		type: TypeAssoc.id,
		author: WrittenByAssoc.id,
		post: CommentedOn.id
	},
	type: Comment.id,
	author: author.id,
	post: post.id,
	content: 'I\'m posting "foobarbaz"'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment