-
Notifications
You must be signed in to change notification settings - Fork 0
API Reference
###GeminiDB:New(addon, defaults, defaultProfile) Creates a new database object that can be used to handle database settings and profiles. By default, an empty DB is created, using a character specific profile.
You can override the default profile used by passing any profile name as the third argument, or by passing true as the third argument to use a globally shared profile called "Default".
Note that there is no token replacement in the default profile name, passing a defaultProfile as "char" will use a profile named "char", and not a character-specific profile.
####Parameters
tbl
- The name of variable, or table to use for the database
defaults
- A table of database defaults
defaultProfile
- The name of the default profile. If not set, a character specific profile will be used as the default. You can also pass true to use a shared global profile called "Default".
####Usage
-- Create an empty DB using a character-specific default profile.
self.db = Apollo.GetPackage("Gemini:DB-1.0").tPackage:New("MyAddonDB")
-- Create a DB using defaults and using a shared default profile
self.db = Apollo.GetPackage("Gemini:DB-1.0").tPackage:New("MyAddonDB", defaults, true)###DBObjectLib:CopyProfile(name, silent) Copies a named profile into the current profile, overwriting any conflicting settings.
####Parameters
name
- The name of the profile to be copied into the current profile
silent
- If true, do not raise an error when the profile does not exist
###DBObjectLib:DeleteProfile(name, silent) Deletes a named profile. This profile must not be the active profile.
####Parameters
name
- The name of the profile to be deleted
silent
- If true, do not raise an error when the profile does not exist
###DBObjectLib:GetCurrentProfile() Returns the current profile name used by the database
###DBObjectLib:GetNamespace(name, silent) Returns an already existing namespace from the database object.
####Parameters
name
- The name of the new namespace
silent
- if true, the addon is optional, silently return nil if its not found
####Return value
The namespace object if found
####Usage
local namespace = self.db:GetNamespace('namespace')###DBObjectLib:GetProfiles(tbl) Returns a table with the names of the existing profiles in the database. You can optionally supply a table to re-use for this purpose.
####Parameters
tbl
- A table to store the profile names in (optional)
###DBObjectLib:RegisterDefaults(defaults) Sets the defaults table for the given database object by clearing any that are currently set, and then setting the new defaults.
####Parameters
defaults
- A table of defaults for this database
###DBObjectLib:RegisterNamespace(name, defaults) Creates a new database namespace, directly tied to the database. This is a full scale database in it's own rights other than the fact that it cannot control its profile individually
####Parameters
name
- The name of the new namespace
defaults
- A table of values to use as defaults
###DBObjectLib:ResetDB(defaultProfile) Resets the entire database, using the string defaultProfile as the new default profile.
####Parameters
defaultProfile *The profile name to use as the default
###DBObjectLib:ResetProfile(noChildren, noCallbacks) Resets the current profile to the default values (if specified).
####Parameters
noChildren
- if set to true, the reset will not be populated to the child namespaces of this DB object
noCallbacks
- if set to true, won't fire the OnProfileReset callback
####DBObjectLib:SetProfile(name) Changes the profile of the database and all of it's namespaces to the supplied named profile
####Parameters
name
- The name of the profile to set as the current profile
###DBObjectLib:SetProfile() Resets the database to default values (if specified)