store

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Core

type Core struct {
	api.IQuery
	// contains filtered or unexported fields
}

Core has the dependencies for the store package.

func NewCore

func NewCore(m *mock.Mocker, db api.IDatabase, q api.IQuery) Core

NewCore returns a new core object.

type Factory

type Factory struct {
	User UserStore
	Note NoteStore
}

Factory is all of the stores in the application.

func NewFactory

func NewFactory(m *mock.Mocker, db api.IDatabase, q api.IQuery) *Factory

NewFactory will return the factory for stores.

type Note

type Note struct {
	ID        string     `db:"id"`
	UserID    string     `db:"user_id"`
	Message   string     `db:"message"`
	CreatedAt *time.Time `db:"created_at"`
	UpdatedAt *time.Time `db:"updated_at"`
	DeletedAt *time.Time `db:"deleted_at"`
}

Note is a note of a user.

func (*Note) PrimaryKey

func (x *Note) PrimaryKey() string

PrimaryKey returns the primary key field.

func (*Note) Table

func (x *Note) Table() string

Table returns the table name.

type NoteGroup

type NoteGroup []Note

NoteGroup represents a group.

func (NoteGroup) PrimaryKey

func (x NoteGroup) PrimaryKey() string

PrimaryKey returns the primary key field.

func (NoteGroup) Table

func (x NoteGroup) Table() string

Table returns the table name.

type NoteStore

type NoteStore struct {
	Core
}

NoteStore .

func NewNoteStore

func NewNoteStore(c Core) NoteStore

NewNoteStore returns a new query object.

func (*NoteStore) Create

func (x *NoteStore) Create(userID, message string) (string, error)

Create adds a new item.

func (*NoteStore) DeleteOneByIDAndUser

func (x *NoteStore) DeleteOneByIDAndUser(dest api.IRecord, ID string,
	userID string) (affected int, err error)

DeleteOneByIDAndUser removes one item from a user.

func (*NoteStore) FindAllByUser

func (x *NoteStore) FindAllByUser(dest *NoteGroup, userID string) (total int, err error)

FindAllByUser returns items for a user.

func (*NoteStore) FindOneByIDAndUser

func (x *NoteStore) FindOneByIDAndUser(dest *Note, ID string, userID string) (exists bool, err error)

FindOneByIDAndUser returns an item for a user.

func (*NoteStore) New

func (x *NoteStore) New() Note

New returns an empty item.

func (*NoteStore) NewGroup

func (x *NoteStore) NewGroup() NoteGroup

NewGroup returns an empty group.

func (*NoteStore) Update

func (x *NoteStore) Update(ID, userID, message string) (affected int, err error)

Update makes changes to an item.

type User

type User struct {
	ID        string     `db:"id"`
	FirstName string     `db:"first_name"`
	LastName  string     `db:"last_name"`
	Email     string     `db:"email"`
	Password  string     `db:"password"`
	StatusID  uint8      `db:"status_id"`
	CreatedAt *time.Time `db:"created_at"`
	UpdatedAt *time.Time `db:"updated_at"`
	DeletedAt *time.Time `db:"deleted_at"`
}

User is a user of the system.

func (*User) PrimaryKey

func (x *User) PrimaryKey() string

PrimaryKey returns the primary key field.

func (*User) Table

func (x *User) Table() string

Table returns the table name.

type UserGroup

type UserGroup []User

UserGroup represents a group.

func (UserGroup) PrimaryKey

func (x UserGroup) PrimaryKey() string

PrimaryKey returns the primary key field.

func (UserGroup) Table

func (x UserGroup) Table() string

Table returns the table name.

type UserStore

type UserStore struct {
	Core
}

UserStore .

func NewUserStore

func NewUserStore(c Core) UserStore

NewUserStore returns a new query object.

func (*UserStore) Create

func (x *UserStore) Create(firstName, lastName, email, password string) (string, error)

Create adds a new item.

func (*UserStore) New

func (x *UserStore) New() User

New returns an empty user.

func (*UserStore) NewGroup

func (x *UserStore) NewGroup() UserGroup

NewGroup returns an empty group.

func (*UserStore) Update

func (x *UserStore) Update(ID, firstName, lastName, email, password string) (affected int, err error)

Update makes changes to an item.

Jump to

Keyboard shortcuts

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