surrealhigh

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2023 License: MIT Imports: 8 Imported by: 0

README

surrealmountain

surrealdb.go higher level library

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoDoc = errors.New("no document matched")
View Source
var (
	ErrNoResult = errors.New("surrealdb: unmarshal results: no `results`")
)

Functions

This section is empty.

Types

type Condition added in v0.2.0

type Condition interface {
	// contains filtered or unexported methods
}

func NewConditionAnd added in v0.2.0

func NewConditionAnd(c0 Condition, c ...Condition) Condition

func NewConditionIs added in v0.2.0

func NewConditionIs(l ConditionAtom, r ConditionAtom) Condition

func NewConditionIsNot added in v0.2.0

func NewConditionIsNot(l ConditionAtom, r ConditionAtom) Condition

func NewConditionOr added in v0.2.1

func NewConditionOr(c0 Condition, c ...Condition) Condition

type ConditionAtom added in v0.2.0

type ConditionAtom interface {
	// contains filtered or unexported methods
}

type ConditionAtomField added in v0.2.0

type ConditionAtomField interface{ ConditionAtom }

func NewConditionAtomField added in v0.2.0

func NewConditionAtomField(f Field) ConditionAtomField

type ConditionAtomVar added in v0.2.0

type ConditionAtomVar interface{ ConditionAtom }

func NewConditionAtomVar added in v0.2.0

func NewConditionAtomVar(name string, value interface{}) ConditionAtomVar

type DBDoc

type DBDoc interface {
	Doc

	json.Marshaler

	DB() *surrealdb.DB
	Create() (Id, error)
}

DBDoc is a low level document as it has a reference to the database driver

type DBSelect added in v0.2.0

type DBSelect[D Doc] interface {
	Do() ([]D, error)
}

func SelectOn added in v0.2.0

func SelectOn[D Doc](q Select, db SelectDriver) DBSelect[D]

type DBSelectAndUpdate added in v0.2.2

type DBSelectAndUpdate[D Doc] interface {
	Do() (D, error)
}

func SelectAndUpdate added in v0.2.2

func SelectAndUpdate[D DocWithID](q Select, update func(D) D, db SelectDriver) DBSelectAndUpdate[D]

type DefaultDoc

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

func NewDefaultDoc

func NewDefaultDoc(doc Doc, db *surrealdb.DB) DefaultDoc

func (DefaultDoc) Create

func (doc DefaultDoc) Create() (Id, error)

func (DefaultDoc) DB

func (doc DefaultDoc) DB() *surrealdb.DB

func (DefaultDoc) MarshalJSON

func (doc DefaultDoc) MarshalJSON() ([]byte, error)

func (DefaultDoc) Table

func (doc DefaultDoc) Table() Table

type Doc

type Doc interface {
	Table() Table
}

type DocWithID added in v0.2.2

type DocWithID interface {
	Doc
	Id() Thing
}

type ErrDuplicateValuation added in v0.2.0

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

func (ErrDuplicateValuation) Error added in v0.2.0

func (err ErrDuplicateValuation) Error() string

type Field added in v0.2.0

type Field string

func (Field) String added in v0.2.0

func (f Field) String() string

type Id

type Id uuid.UUID

func NewID

func NewID() Id

func (Id) String

func (i Id) String() string

func (Id) Thing

func (i Id) Thing(t Table) Thing

type QueryOption added in v0.2.0

type QueryOption func(Select) Select

func QueryOptionOrderByAsc added in v0.2.0

func QueryOptionOrderByAsc(f Field) QueryOption

func QueryOptionOrderByDesc added in v0.2.0

func QueryOptionOrderByDesc(f Field) QueryOption

func QueryOptionWhere added in v0.2.0

func QueryOptionWhere(c Condition) QueryOption

type Select added in v0.2.0

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

func NewQueryFrom added in v0.2.0

func NewQueryFrom(from Table, opts ...QueryOption) Select

func (Select) String added in v0.2.0

func (vc Select) String() string

type SelectDriver added in v0.2.0

type SelectDriver interface {
	// contains filtered or unexported methods
}

func DefaultDriver added in v0.2.0

func DefaultDriver(db *surrealdb.DB) SelectDriver

type Table

type Table string

func (Table) Prefix

func (t Table) Prefix() string

type Thing

type Thing string

Thing is a pointer to a Doc

func (Thing) String

func (t Thing) String() string

Jump to

Keyboard shortcuts

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