Thread overview | |||||
---|---|---|---|---|---|
|
August 11, 2017 Persistent Storage | ||||
---|---|---|---|---|
| ||||
Does D have a persistent storage somewhere? I'd like something easy to use that allows me to load and save settings to disk in between executions of the program. I want to specify the variable to be saved or loaded and a default value. e.g., Persist_Load(Some_variable, 100); will load Some_variable from disk. If the storage does not exist on disk it will use the value 100. It should manage the variables internally so it knows what is what. I don't mind actually specifying some_variable as a string to do this or using mixins and templates to achieve this, but it should be a one liner thing. |
August 12, 2017 Re: Persistent Storage | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mr. Pib | On Friday, 11 August 2017 at 22:21:53 UTC, Mr. Pib wrote: > Does D have a persistent storage somewhere? I'd like something easy to use that allows me to load and save settings to disk in between executions of the program. I want to specify the variable to be saved or loaded and a default value. > > e.g., > > Persist_Load(Some_variable, 100); > > will load Some_variable from disk. If the storage does not exist on disk it will use the value 100. > > It should manage the variables internally so it knows what is what. I don't mind actually specifying some_variable as a string to do this or using mixins and templates to achieve this, but it should be a one liner thing. Try a serialization library or inifiled. Some may even use a DB with ORM for this. https://code.dlang.org/packages/inifiled https://code.dlang.org/packages/jsonizer https://code.dlang.org/packages/asdf https://code.dlang.org/packages/yamlserialized etc... there are much. |
August 12, 2017 Re: Persistent Storage | ||||
---|---|---|---|---|
| ||||
Posted in reply to HyperParrow | On Saturday, 12 August 2017 at 01:16:35 UTC, HyperParrow wrote:
> On Friday, 11 August 2017 at 22:21:53 UTC, Mr. Pib wrote:
>> [...]
>
> Try a serialization library or inifiled. Some may even use a DB with ORM for this.
>
> https://code.dlang.org/packages/inifiled
> https://code.dlang.org/packages/jsonizer
> https://code.dlang.org/packages/asdf
> https://code.dlang.org/packages/yamlserialized
>
> etc... there are much.
Thanks, I wrote my own quick version for what I need so I'll probably use that for now. In the future I might look in to those.
|
Copyright © 1999-2021 by the D Language Foundation