query

package
v0.0.0-...-f0f63f4 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Q

type Q struct {
	Mock *mock.Mocker
	// contains filtered or unexported fields
}

Q is a database wrapper that provides helpful utilities.

func New

func New(m *mock.Mocker, db api.IDatabase) *Q

New returns a new query object.

func (*Q) DeleteAll

func (q *Q) DeleteAll(dest api.IRecord) (affected int, err error)

DeleteAll removes all records.

func (*Q) DeleteOneByID

func (q *Q) DeleteOneByID(dest api.IRecord, ID string) (affected int, err error)

DeleteOneByID removes one record by ID.

func (*Q) ExistsByField

func (q *Q) ExistsByField(db api.IRecord, field string, value string) (found bool, ID string, err error)

ExistsByField determines if a records exists by a specified field and returns the ID.

func (*Q) ExistsByID

func (q *Q) ExistsByID(db api.IRecord, value string) (found bool, err error)

ExistsByID determines if a records exists by ID.

func (*Q) FindAll

func (q *Q) FindAll(dest api.IRecord) (total int, err error)

FindAll returns all users.

func (*Q) FindOneByField

func (q *Q) FindOneByField(dest api.IRecord, field string, value string) (exists bool, err error)

FindOneByField will find a record by a specified field.

func (*Q) FindOneByID

func (q *Q) FindOneByID(dest api.IRecord, ID string) (exists bool, err error)

FindOneByID will find a record by string ID.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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