db

package
v0.0.0-...-8dc6894 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: Unlicense Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeSchema

func MakeSchema(gdb *genji.DB) error

MakeSchema create tables for `accounts` if not exists.

func QueryTable

func QueryTable(db *genji.DB, in interface{}, sql string, outcb func(out interface{})) error

func RegisterModels

func RegisterModels(mod string, mds []DbModel)

RegisterModels for mod-*, For example, mod-accounts, mod-chat, sys-core.

func SharedDatabase

func SharedDatabase() *genji.DB

SharedDatabase Returns the global Genji database shared pointer.

func UID

func UID() string

UID Generate ksuid.

Types

type DbModel

type DbModel interface {
	//Table name
	TableName() string
	//Used to return the SQL used to create tables and indexes
	CreateSQL() []string
}

DbModel Basic table model interface,

Jump to

Keyboard shortcuts

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