datascript icon indicating copy to clipboard operation
datascript copied to clipboard

Documentation?

Open zilti opened this issue 10 years ago • 12 comments

This project has my interest, and I'd also like to use it in my project, if it's capable of what I think it is. But... there's no documentation linked. Zero. Nothing. Where do I find the API? And a useful introduction?

zilti avatar Dec 05 '15 17:12 zilti

@zilti In the readme, in the Project Status section, it says:

"No docs at the moment, use examples & Datomic documentation."

So you can use the datomic documentation API. There is a separate section that details how different the datascript api is from datomic's.

livtanong avatar Dec 08 '15 11:12 livtanong

Sorry @zilti, docs are not there yet.

Datomic team has excellent intro videos explaining basic concepts:

  • http://www.youtube.com/watch?v=RKcqYZZ9RDY
  • http://www.youtube.com/watch?v=bAilFQdaiHk

This is one of the best ways to learn about and master DataLog:

  • http://www.learndatalogtoday.org

Most of the API is similar to Datomic which is documented here:

  • http://docs.datomic.com/query.html
  • http://docs.datomic.com/transactions.html
  • http://docs.datomic.com/schema.html
  • http://docs.datomic.com/identity.html
  • http://docs.datomic.com/indexes.html
  • http://docs.datomic.com/pull.html

After that, there’s a short section explaining how DataScript is different:

  • https://github.com/tonsky/datascript#differences-from-datomic

A good idea might be to listen to a webinar where I write an app using most of DataScript features:

  • https://vimeo.com/114688970

Hope that helps!

tonsky avatar Dec 09 '15 12:12 tonsky

I’ll maintain an actual list of resources here: https://github.com/tonsky/datascript/wiki/Getting-started

tonsky avatar Dec 09 '15 12:12 tonsky

How about some notes on using Datascript from a Javascript project. I see the core API is defined with export annotations in core.cljs Would be nice with a quick guide and bullet list of main API.

kristianmandrup avatar Feb 27 '16 12:02 kristianmandrup

+1 for JS docs.

aadrian avatar Feb 27 '16 15:02 aadrian

Install datascript via npm or directly use the min.js release

Read up on js interop

look at core and other main namespaces.

Use datascript core API like this ;)

var d$ = datascript.core;
d$.q(...);

munging function names

I started this wiki page on the topic

kristianmandrup avatar Feb 27 '16 15:02 kristianmandrup

@kristianmandrup this is a bad idea, you’ll have to do a lot of repetitive manual conversions to bridge with cljs api from js.

DataScript has a dedicated JS api, it’s better to use it. Here’s a lot of examples: https://github.com/tonsky/datascript/blob/master/test/js/tests.js#L101

tonsky avatar Feb 27 '16 17:02 tonsky

Thanks @tonsky. I found the js api and listed it here... (WIP) https://github.com/tonsky/datascript/wiki/Javascript-API

Too bad the functions don't yet have doc strings to describe their basic functionality. Then you could also generate docs for each release. Which cljs doc tool is most used/mature?

kristianmandrup avatar Feb 27 '16 17:02 kristianmandrup

I started this api overview wiki page. Please help out ;)

kristianmandrup avatar Feb 29 '16 10:02 kristianmandrup

nice!

On Mon, Feb 29, 2016 at 4:06 PM Kristian Mandrup [email protected] wrote:

I started this api overview https://github.com/tonsky/datascript/wiki/API-overview wiki page. Please help out ;)

— Reply to this email directly or view it on GitHub https://github.com/tonsky/datascript/issues/135#issuecomment-190136972.

tonsky avatar Feb 29 '16 10:02 tonsky

@tonsky Could you please help document how to upsert data ;) Thanks! I don't quite understand the test example.

kristianmandrup avatar Feb 29 '16 11:02 kristianmandrup

this is a bad idea, you’ll have to do a lot of repetitive manual conversions to bridge with cljs api from js.

@tonsky https://github.com/typeetfunc/datascript-mori/blob/master/release-js/test/onlyCljsApiUsage.spec.js Example of usage only CLJS API from JS without any conversions(except mori.parse for parsing EDN string). In real-world JS app (in particular React App) you forced to use immutable data structures(otherwise your application will very slow). When using DataScript JS API, you need to convert result of query(q, pull etc.) from JS data structures to immutable data structures(Immutable.js, Mori, etc.) - is not good for perfomance and code cleanliness. It is also possible to combine CLJS API(for quering) and JS API(for other) - see example

typeetfunc avatar Mar 08 '16 15:03 typeetfunc