wdb

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package wdb contains the realm databases. For server content, in-memory databases are utilized to maximize performance. For character-generated data, a SQL backend is used.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetField

func GetField(fieldName string, value reflect.Value, locale i18n.Locale) (text string)

func GetID

func GetID(value reflect.Value) string

func GetName

func GetName(value reflect.Value, locale i18n.Locale) (text string)

func SetEntry

func SetEntry(value reflect.Value, entry uint32)

func SortNamedTemplates

func SortNamedTemplates(locale i18n.Locale, value reflect.Value)

Types

type Bucket

type Bucket struct {
	Type     reflect.Type
	Storage  *leveldb.DB
	Index    *leveldb.DB
	Sequence uint64
	// contains filtered or unexported fields
}

type BucketKey

type BucketKey struct {
	Type BucketKeyType
	Data []byte
}

type BucketKeyType

type BucketKeyType uint8
const (
	BucketKeyStringID BucketKeyType = iota
	BucketKeyUint32ID
	BucketKeySequence
	BucketKeyEntry
	BucketIndexSequence
)

type Cache

type Cache struct {
	Dir     string
	Buckets map[reflect.Type]*Bucket
}

func (*Cache) Bucket

func (c *Cache) Bucket(typeOf reflect.Type) (*Bucket, error)

func (*Cache) BucketPath

func (c *Cache) BucketPath(typeOf reflect.Type) string

func (*Cache) Clear

func (c *Cache) Clear(typeOf reflect.Type)

func (*Cache) IndexPath

func (c *Cache) IndexPath(typeOf reflect.Type) string

func (*Cache) Lookup

func (c *Cache) Lookup(indexType BucketKeyType, key, value any)

func (*Cache) QueryField

func (c *Cache) QueryField(locale i18n.Locale, field string, regex string, limit int64, sliceptr any) error

func (*Cache) QueryNames

func (c *Cache) QueryNames(locale i18n.Locale, regex string, limit int64, sliceptr any) error

func (*Cache) Range

func (c *Cache) Range(fn interface{})

func (*Cache) Size

func (c *Cache) Size() uint64

func (*Cache) Store

func (c *Cache) Store(value reflect.Value)

type Core

type Core struct {
	*xorm.Engine
	Cache
}

func NewCore

func NewCore(driver, source string) (*Core, error)

func (*Core) AsyncTx

func (c *Core) AsyncTx(fn func(*Tx))

func (*Core) GetGameObjectTemplate

func (c *Core) GetGameObjectTemplate(id string) (*models.GameObjectTemplate, error)

func (*Core) GetGameObjectTemplateByEntry

func (c *Core) GetGameObjectTemplateByEntry(entry uint32) (*models.GameObjectTemplate, error)

func (*Core) GetItemTemplate

func (c *Core) GetItemTemplate(id string) (*models.ItemTemplate, error)

func (*Core) GetItemTemplateByEntry

func (c *Core) GetItemTemplateByEntry(entry uint32) (*models.ItemTemplate, error)

func (*Core) InitCache

func (c *Core) InitCache(dir string) error

func (*Core) Println

func (c *Core) Println(args ...any)

func (*Core) Query

func (db *Core) Query() *Query

type Query

type Query struct {
	Core         *Core
	Conditions   []*QueryCondition
	OrderByField int
	ResultLimit  int
	Asc          bool
}

func (*Query) Get

func (q *Query) Get(sliceptr any) error

func (*Query) Limit

func (q *Query) Limit(limit int) *Query

func (*Query) WhereFieldIs

func (q *Query) WhereFieldIs(fieldName string, value any) *Query

type QueryCondition

type QueryCondition struct {
	Field    string
	Flags    QueryFlags
	Param1   reflect.Value
	Likeness float64
}

type QueryFlags

type QueryFlags uint8
const (
	QueryIs QueryFlags = 1 << iota
	QueryNot
	QueryExact
	QueryGt
	QueryLt
	QueryEq
)

type Store

type Store struct {
	// contains filtered or unexported fields
}

func (*Store) Range

func (s *Store) Range(fn func(k, v interface{}) bool)

type Tx

type Tx struct {
	*xorm.Session
}

Directories

Path Synopsis
package realm/wdb/models Contains models for game data, type enums, and conversion functions
package realm/wdb/models Contains models for game data, type enums, and conversion functions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL