store

create or load a persistent store on disk


Parameters

store path :string :literal

Attributes

deferredsave to disk only on program termination
globalsave as global store
nativeforce native/Arturo format
jsonforce Json format
dbforce database/SQlite format

Returns

  • :range

Examples

copy
; create a new store with the name `mystore` ; it will be automatically live-stored in a file in the same folder ; using the native Arturo format data: store "mystore" ; store some data data\name: "John" data\surname: "Doe" data\age: 36 ; and let's retrieve our data data ; => [name:"John" surname:"Doe" age:36]

copy
; create a new "global" configuration store ; that will be saved automatically in ~/.arturo/stores globalStore: store.global "configuration" ; we are now ready to add or retrieve some persistent data!

copy
; create a new JSON store with the name `mystore` ; it will be automatically live-stored in a file in the same folder ; with the name `mystore.json` data: store.json "mystore" ; store some data da\people: [] ; data can be as complicated as in any normal dictionary da\people: da\people ++ #[name: "John" surname: "Doe"] ; check some specific store value da\people\0\name ; => "John"

copy
; create a new deferred store with the name `mystore` ; it will be automatically saved in a file in the same folder ; using the native Arturo format defStore: store.deferred "mystore" ; let's save some data defStore\name: "John" defStore\surname: "Doe" ; and print it print defStore ; [name:John surname:Doe] ; in this case, all data is available at any given moment ; but will not be saved to disk for each and every operation; ; instead, it will be saved in its totality just before ; the program terminates!

Related