Documentation
¶
Index ¶
- Constants
- func Create(path string, ctx context.Context) error
- type CreateNewReportParams
- type DBTX
- type DeleteReportByHashParams
- type DeleteReportByNameParams
- type Error
- type GetReportByHashParams
- type GetReportByHashRow
- type GetReportsByTurnParams
- type GetReportsByTurnRow
- type Queries
- func (q *Queries) CreateNewReport(ctx context.Context, arg CreateNewReportParams) (int64, error)
- func (q *Queries) DeleteReportByHash(ctx context.Context, arg DeleteReportByHashParams) error
- func (q *Queries) DeleteReportByName(ctx context.Context, arg DeleteReportByNameParams) error
- func (q *Queries) GetReportByHash(ctx context.Context, arg GetReportByHashParams) (GetReportByHashRow, error)
- func (q *Queries) GetReportsByTurn(ctx context.Context, arg GetReportsByTurnParams) ([]GetReportsByTurnRow, error)
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
- type Report
- type Report_t
- type Store
- func (s *Store) Close() error
- func (s *Store) CreateNewReport(clan, year, month int, unit, hash string, lines []byte) (int, error)
- func (s *Store) Delete(stmt string) (sql.Result, error)
- func (s *Store) DeleteReportByHash(clan int, hash string) error
- func (s *Store) DeleteReportByName(clan, year, month int, unit string) error
- func (s *Store) GetReportByHash(clan int, hash string) (*Report_t, error)
- func (s *Store) GetReportsByTurn(clan, year, month int) ([]*Report_t, error)
- func (s *Store) Update(stmt string) (sql.Result, error)
Constants ¶
const ( ErrCreateSchema = Error("create schema") ErrDatabaseExists = Error("database exists") ErrDuplicateHash = Error("duplicate hash") ErrDuplicateReportName = Error("duplicate report name") ErrForeignKeysDisabled = Error("foreign keys disabled") ErrInvalidClanId = Error("invalid clan id") ErrInvalidHash = Error("invalid hash") ErrInvalidPath = Error("invalid path") ErrInvalidMonth = Error("invalid month") ErrInvalidUnit = Error("invalid unit") ErrInvalidYear = Error("invalid year") ErrNotDirectory = Error("not a directory") ErrNotFound = Error("not found") ErrPragmaReturnedNil = Error("pragma returned nil") )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateNewReportParams ¶
type GetReportByHashParams ¶
type GetReportByHashRow ¶
type GetReportsByTurnParams ¶
type GetReportsByTurnRow ¶
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) CreateNewReport ¶
Copyright (c) 2024 Michael D Henderson. All rights reserved.
-------------------------------------------------------------------------- CreateNewReport creates a new report.
func (*Queries) DeleteReportByHash ¶
func (q *Queries) DeleteReportByHash(ctx context.Context, arg DeleteReportByHashParams) error
-------------------------------------------------------------------------- DeleteReportByHash deletes a report by its hash value.
func (*Queries) DeleteReportByName ¶
func (q *Queries) DeleteReportByName(ctx context.Context, arg DeleteReportByNameParams) error
-------------------------------------------------------------------------- DeleteReportByName returns a report by its name (year, month and unit).
func (*Queries) GetReportByHash ¶
func (q *Queries) GetReportByHash(ctx context.Context, arg GetReportByHashParams) (GetReportByHashRow, error)
-------------------------------------------------------------------------- GetReportByHash returns a report by its hash value.
func (*Queries) GetReportsByTurn ¶
func (q *Queries) GetReportsByTurn(ctx context.Context, arg GetReportsByTurnParams) ([]GetReportsByTurnRow, error)
-------------------------------------------------------------------------- GetReportsByTurn returns a report by its turn number (year and month).
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func Open ¶
Open opens an existing store. Returns an error if the database file is not a valid file. Caller must call Close() when done.
func (*Store) CreateNewReport ¶
func (s *Store) CreateNewReport(clan, year, month int, unit, hash string, lines []byte) (int, error)
CreateNewReport creates a new report. Returns the id of the new report. Accepts empty input for lines.
func (*Store) DeleteReportByHash ¶
DeleteReportByHash deletes a report by its hash. Returns nil if no report is found.
func (*Store) DeleteReportByName ¶
DeleteReportByName deletes a report by its name (year, month and unit). Returns nil if no report is found.
func (*Store) GetReportByHash ¶
GetReportByHash returns a report by its hash. If no report is found, nil is return with no error.
func (*Store) GetReportsByTurn ¶
GetReportsByTurn returns a list of reports for the requested clan, year, and month. If no reports are found, an empty list is returned.