#godot #save #in-memory #items #interface #superfast

gddb

GDDB is a superfast in-memory database designed for use in Godot

5 unstable releases

0.3.1 Mar 20, 2022
0.3.0 Mar 12, 2022
0.2.0 Mar 10, 2022
0.1.1 Oct 12, 2021
0.1.0 Oct 6, 2021

#1912 in Database interfaces

MIT license

29KB
355 lines

GDDB

crates.io Cross-compile Documentation Version License

GDDB is a superfast in-memory database designed for use in Godot.

This database aims to provide an easy frontend to an efficient in-memory database, that can be saved and reloaded.

GDDB saves a Godot dictionary and provides an interface to create, update, retrieve (either single results or all items matching the search) and destroy records.

GDDB started as a fork of TinyDB with added functionality and a Godot wrapper.

Installation

  • git clone https://github.com/patchfx/gddb.git
  • cd gddb
  • cargo build
  • Copy the libgddb.(dll|so) to your Godot project
  • Create a new GDNativeLibrary and link to the lib
  • Create a new GDNativeScript filed with a class name of 'GDDB'
  • Attach the GDNativeLibrary to the GDNativeScript
  • Autoload the GDNativeScript

Example

extends Node

func _ready():
	var data = { "name": "Joe Bloggs" }
	var player_uuid = Database.create("Player", data)
	print(player_uuid)

	var record = Database.find(player_uuid)
	print(record.name)

	record.name = "John Doe"
	Database.update(record.uuid, record.model, record.attributes)

	var updated = Database.find(player_uuid)
	print(updated.name)

Dependencies

~8–16MB
~230K SLoC