tickets

package
Version: v0.0.0-...-1a29aff Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetNamedStmts

func SetNamedStmts() error

SetNamedStmts initializes named statements

Types

type Amount

type Amount struct {
	ID          int64      `db:"id" json:"id"`
	UserID      int64      `db:"user_id" json:"user_id"`
	TicketID    int64      `db:"ticket_id" json:"ticket_id"`
	Description string     `db:"description" json:"description"`
	Amount      float64    `db:"amount" json:"amount"`
	AmountedAt  *time.Time `db:"amounted_at" json:"amounted_at"`
}

Amount represents an amount logged against a ticket

func CreateAmount

func CreateAmount(userID int64, a *Amount) (*Amount, error)

CreateAmount adds a new amount record to the database

func GetAmountsByUserID

func GetAmountsByUserID(userID int64, aq *AmountQuery) ([]Amount, error)

GetAmountsByUserID returns all amounts in the database associated with a user id

func UpdateAmount

func UpdateAmount(userID int64, m *Amount) (*Amount, error)

UpdateAmount updates a amount record in the database

type AmountQuery

type AmountQuery struct {
	UserID         int64      `db:"user_id"`
	AmountedAfter  *time.Time `db:"amounted_after"`
	AmountedBefore *time.Time `db:"amounted_before"`
}

AmountQuery defines the parameters for listing times

type Ticket

type Ticket struct {
	ID          int64      `db:"id" json:"id"`
	UserID      int64      `db:"user_id" json:"user_id"`
	Description string     `db:"description" json:"description"`
	ClosedAt    *time.Time `db:"closed_at" json:"closed_at"`
	DaysInWeek  float32    `db:"days_in_week" json:"days_in_week"`
	Priority    int64      `db:"priority" json:"priority"`
}

Ticket is an activity that a user can log time or amounts against

func CreateTicket

func CreateTicket(userID int64, t *Ticket) (*Ticket, error)

CreateTicket adds a ticket record to the database

func GetTicketsByUserID

func GetTicketsByUserID(id int64) ([]Ticket, error)

GetTicketsByUserID returns all tickets in the database associated with a user id

type Time

type Time struct {
	ID          int64      `db:"id" json:"id"`
	UserID      int64      `db:"user_id" json:"user_id"`
	TicketID    int64      `db:"ticket_id" json:"ticket_id"`
	Description string     `db:"description" json:"description"`
	StartedAt   *time.Time `db:"started_at" json:"started_at"`
	BrokeAt     *time.Time `db:"broke_at" json:"broke_at"`
	EndedAt     *time.Time `db:"ended_at" json:"ended_at"`
}

Time represents time logged against a ticket

func CreateTime

func CreateTime(userID int64, t *Time) (*Time, error)

CreateTime adds a new time record to the database

func DeleteTime

func DeleteTime(userID int64, t *Time) (*Time, error)

DeleteTime deletes a time record from the database

func GetTimesByUserID

func GetTimesByUserID(userID int64, tq *TimeQuery) ([]Time, error)

GetTimesByUserID returns all times in the database associated with a user id

func UpdateTime

func UpdateTime(userID int64, t *Time) (*Time, error)

UpdateTime updates a time record in the database

type TimeQuery

type TimeQuery struct {
	UserID        int64      `db:"user_id"`
	StartedAfter  *time.Time `db:"started_after"`
	StartedBefore *time.Time `db:"started_before"`
	OmitEnded     bool
}

TimeQuery defines the parameters for listing times

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL