Documentation ¶
Overview ¶
Package repositorystore contains the CRUD operations for the repository on the database
Index ¶
- Variables
- type Repository
- func (r *Repository) Create(ctx context.Context, db *sqlx.DB) error
- func (r *Repository) Delete(ctx context.Context, db *sqlx.DB) error
- func (r *Repository) IsValid() bool
- func (r *Repository) Read(ctx context.Context, db *sqlx.DB) error
- func (r *Repository) Update(ctx context.Context, db *sqlx.DB) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrIDMissing will be thrown if an ID is expected but not set ErrIDMissing = errors.New("id is mandatory for this operation") // ErrIDIsSet will be thrown if no ID is expected but already set ErrIDIsSet = errors.New("id should be not set for this operation, use update instead") // ErrDataMissing will be thrown if mandatory data is not set ErrDataMissing = errors.New("no data or mandatory data missing") )
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository struct { ID int `db:"id"` Name string `db:"name"` URL string `db:"url"` CreatedAt time.Time `db:"created_at"` ModifiedAt time.Time `db:"modified_at"` }
Repository represents the repository in the database
func (*Repository) IsValid ¶
func (r *Repository) IsValid() bool
IsValid returns true if all mandatory fields are set
Click to show internal directories.
Click to hide internal directories.