Documentation ¶
Index ¶
- type GopherRepository
- func (r *GopherRepository) Create(ctx context.Context, params GopherRepositoryCreateParams) (int, error)
- func (r *GopherRepository) Delete(ctx context.Context, id int) error
- func (r *GopherRepository) Find(ctx context.Context, id int) (model.Gopher, error)
- func (r *GopherRepository) FindAll(ctx context.Context, params GopherRepositoryFindAllParams) ([]model.Gopher, error)
- type GopherRepositoryCreateParams
- type GopherRepositoryFindAllParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GopherRepository ¶
type GopherRepository struct {
// contains filtered or unexported fields
}
GopherRepository is the repository to handle the model.Gopher model database interactions.
func NewGopherRepository ¶
func NewGopherRepository(db *sql.DB) *GopherRepository
NewGopherRepository returns a new GopherRepository.
func (*GopherRepository) Create ¶
func (r *GopherRepository) Create(ctx context.Context, params GopherRepositoryCreateParams) (int, error)
Create creates a new gopher and returns its id.
func (*GopherRepository) Delete ¶
func (r *GopherRepository) Delete(ctx context.Context, id int) error
Delete deletes an existing gopher by id.
func (*GopherRepository) FindAll ¶
func (r *GopherRepository) FindAll(ctx context.Context, params GopherRepositoryFindAllParams) ([]model.Gopher, error)
FindAll finds all gophers.
type GopherRepositoryCreateParams ¶
type GopherRepositoryCreateParams struct { Name string Job sql.NullString }
GopherRepositoryCreateParams is a parameter for Create.
type GopherRepositoryFindAllParams ¶
type GopherRepositoryFindAllParams struct { Name sql.NullString Job sql.NullString }
GopherRepositoryFindAllParams is a parameter for FindAll.
Click to show internal directories.
Click to hide internal directories.