repository

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockRepository

type MockRepository struct {
	mock.Mock
}

func NewMockRepository

func NewMockRepository() *MockRepository

func (*MockRepository) CreateOrUpdate

func (r *MockRepository) CreateOrUpdate(ctx context.Context, cookie Model) (*Model, error)

func (*MockRepository) Delete

func (r *MockRepository) Delete(ctx context.Context, cookieID xid.ID) error

func (*MockRepository) GetByID

func (r *MockRepository) GetByID(ctx context.Context, cookieID xid.ID) (*Model, error)

func (*MockRepository) ListAll

func (r *MockRepository) ListAll(ctx context.Context) ([]*Model, error)

type Model

type Model struct {
	ID       xid.ID  `db:"id"`
	Title    string  `db:"title"`
	Category *string `db:"category"`
	Fortune  string  `db:"fortune"`
	// contains filtered or unexported fields
}

type Repository

type Repository interface {
	CreateOrUpdate(ctx context.Context, cookie Model) (*Model, error)
	GetByID(ctx context.Context, cookieID xid.ID) (*Model, error)
	ListAll(ctx context.Context) ([]*Model, error)
	Delete(ctx context.Context, cookieID xid.ID) error
}

func NewSQLRepository

func NewSQLRepository(db *pgx.Conn) (Repository, error)

type SQLRepository

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

func (*SQLRepository) CreateOrUpdate

func (r *SQLRepository) CreateOrUpdate(ctx context.Context, cookie Model) (*Model, error)

func (*SQLRepository) Delete

func (r *SQLRepository) Delete(ctx context.Context, cookieID xid.ID) error

func (*SQLRepository) GetByID

func (r *SQLRepository) GetByID(ctx context.Context, cookieID xid.ID) (*Model, error)

func (*SQLRepository) ListAll

func (r *SQLRepository) ListAll(ctx context.Context) ([]*Model, error)

Jump to

Keyboard shortcuts

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