require "./src/dodb.cr"

class Car
	include JSON::Serializable

	property name : String
	property color : String
	property keywords : Array(String)

	def initialize(@name, @color, @keywords)
	end
end

# Database creation
db = DODB::DataBase(Car).new "db-cars"

# Adding an element to the db
db << Car.new "Corvet", "red", ["elegant", "fast"]

# Reaching all objects in the db
db.each do |car|
	pp! car
end

# Reaching all objects in the db with their key.
db.each_with_key do |car,key|
	pp! car, key
end

db.delete 0