ydb

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GopPackage = "github.com/goplus/yap/test"
)

Variables

View Source
var (
	ErrNoRows     = sql.ErrNoRows
	ErrDuplicated = errors.New("duplicated")
	ErrOutOfLimit = errors.New("out of limit")
)

Functions

func Gopt_AppGen_Main

func Gopt_AppGen_Main(app interface{ initApp() }, workers ...interface{ initClass(self any) })

func Gopt_Sql_Gopx_Table

func Gopt_Sql_Gopx_Table[Schema any](sql interface{ defineTable(string, any) }, nameVer string)

Table creates a new table by specified Schema.

func Register

func Register(e *Engine)

Register registers an engine.

Types

type AppGen

type AppGen struct {
}

type Class

type Class struct {
	Sql

	test.Case
	// contains filtered or unexported fields
}

func (*Class) Count added in v0.7.6

func (p *Class) Count(cond string, args ...any) (n int, err error)

Count returns rows of a query result.

func (*Class) Delete added in v0.7.6

func (p *Class) Delete(cond string, args ...any) (sql.Result, error)

Delete deltes rows by cond.

  • delete <cond>, <arg1>, <arg2>, ...

func (*Class) Gop_Exec added in v0.7.6

func (p *Class) Gop_Exec(name string, args ...any)

func (*Class) Insert added in v0.7.6

func (p *Class) Insert(args ...any) (sql.Result, error)

Insert inserts new rows.

  • insert <colName1>, <val1>, <colName2>, <val2>, ...
  • insert <colName1>, <valSlice1>, <colName2>, <valSlice2>, ...
  • insert <structValOrPtr>
  • insert <structOrPtrSlice>

func (*Class) LastErr added in v0.7.6

func (p *Class) LastErr() error

LastErr returns last error.

func (*Class) Limit__0

func (p *Class) Limit__0(n int)

Limit sets query result rows limit.

func (*Class) Limit__1

func (p *Class) Limit__1(n int, cond string, args ...any) error

Limit checks if query result rows is < n or not.

func (*Class) NoRows added in v0.7.6

func (p *Class) NoRows() bool

NoRows checkes there are query result rows or not.

func (*Class) OnErr

func (p *Class) OnErr(onErr func(error))

OnErr sets error processing of a sql execution.

func (*Class) Out

func (p *Class) Out(i int) any

Out returns the ith reuslt.

func (*Class) Query added in v0.7.6

func (p *Class) Query(cond string, args ...any)

Query creates a new query.

  • query <cond>, <arg1>, <arg2>, ...

func (*Class) Ret added in v0.7.6

func (p *Class) Ret(args ...any)

Ret checks a query or call result.

For checking query result:

  • ret <expr1>, &<var1>, <expr2>, &<var2>, ...
  • ret <expr1>, &<varSlice1>, <expr2>, &<varSlice2>, ...
  • ret &<structVar>
  • ret &<structSlice>

For checking call result:

  • ret <expr1>, <expr2>, ...

func (*Class) Use

func (p *Class) Use(table string)

Use sets the default table used in following sql operations.

type Engine

type Engine struct {
	Name       string
	TestSource any // can be a `string` or a `func() string` object.
	WrapErr    func(prompt string, err error) error
}

type Sql

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

func (*Sql) Engine__0

func (p *Sql) Engine__0(name string)

Engine initializes database by specified engine name.

func (*Sql) Engine__1

func (p *Sql) Engine__1() string

Engine returns engine name of the database.

type Table

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

Directories

Path Synopsis
demo
foo

Jump to

Keyboard shortcuts

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