db

package
v0.0.0-...-4cf4b36 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type Event

type Event struct {
	EventID      pgtype.UUID      `json:"event_id"`
	EventPrivacy int32            `json:"event_privacy"`
	Name         string           `json:"name"`
	Description  string           `json:"description"`
	Type         string           `json:"type"`
	Department   string           `json:"department"`
	Regions      []string         `json:"regions"`
	Tags         []string         `json:"tags"`
	StartAt      pgtype.Timestamp `json:"start_at"`
}

type GetEventsParams

type GetEventsParams struct {
	Column1 pgtype.Text `json:"column_1"`
	Limit   int32       `json:"limit"`
	Offset  int32       `json:"offset"`
}

type GetKpisParams

type GetKpisParams struct {
	Column1 pgtype.Text `json:"column_1"`
	Limit   int32       `json:"limit"`
	Offset  int32       `json:"offset"`
}

type GetOkrByIDRow

type GetOkrByIDRow struct {
	OkrID          pgtype.UUID `json:"okr_id"`
	OkrName        string      `json:"okr_name"`
	OkrNumber      int32       `json:"okr_number"`
	OkrYear        int32       `json:"okr_year"`
	OkrDescription string      `json:"okr_description"`
	KeyResults     interface{} `json:"key_results"`
}

type GetOkrsParams

type GetOkrsParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type GetOkrsRow

type GetOkrsRow struct {
	OkrID          pgtype.UUID `json:"okr_id"`
	OkrName        string      `json:"okr_name"`
	OkrNumber      int32       `json:"okr_number"`
	OkrYear        int32       `json:"okr_year"`
	OkrDescription string      `json:"okr_description"`
	KeyResults     interface{} `json:"key_results"`
}

type InsertEventParams

type InsertEventParams struct {
	EventPrivacy int32            `json:"event_privacy"`
	Name         string           `json:"name"`
	Description  string           `json:"description"`
	Type         string           `json:"type"`
	Department   string           `json:"department"`
	Regions      []string         `json:"regions"`
	Tags         []string         `json:"tags"`
	StartAt      pgtype.Timestamp `json:"start_at"`
}

type InsertKeyResultParams

type InsertKeyResultParams struct {
	OkrID       pgtype.UUID `json:"okr_id"`
	Name        string      `json:"name"`
	Number      int32       `json:"number"`
	Description string      `json:"description"`
	Sponsor     string      `json:"sponsor"`
	Kpis        string      `json:"kpis"`
	Scope       string      `json:"scope"`
	Initiatives string      `json:"initiatives"`
}

type InsertKpiParams

type InsertKpiParams struct {
	Name   string      `json:"name"`
	Value  float64     `json:"value"`
	Target float64     `json:"target"`
	Day    pgtype.Date `json:"day"`
}

type InsertOkrParams

type InsertOkrParams struct {
	Name        string `json:"name"`
	Number      int32  `json:"number"`
	Year        int32  `json:"year"`
	Description string `json:"description"`
}

type InsertOkrRow

type InsertOkrRow struct {
	OkrID          pgtype.UUID `json:"okr_id"`
	OkrName        string      `json:"okr_name"`
	OkrNumber      int32       `json:"okr_number"`
	OkrYear        int32       `json:"okr_year"`
	OkrDescription string      `json:"okr_description"`
}

type Kpi

type Kpi struct {
	ID        pgtype.UUID      `json:"id"`
	Name      string           `json:"name"`
	Value     float64          `json:"value"`
	Target    float64          `json:"target"`
	Day       pgtype.Date      `json:"day"`
	CreatedAt pgtype.Timestamp `json:"created_at"`
	UpdatedAt pgtype.Timestamp `json:"updated_at"`
}

type Okr

type Okr struct {
	ID          pgtype.UUID `json:"id"`
	Name        string      `json:"name"`
	Number      int32       `json:"number"`
	Year        int32       `json:"year"`
	Description string      `json:"description"`
}

type OkrKr

type OkrKr struct {
	ID          pgtype.UUID `json:"id"`
	OkrID       pgtype.UUID `json:"okr_id"`
	Name        string      `json:"name"`
	Number      int32       `json:"number"`
	Description string      `json:"description"`
	Sponsor     string      `json:"sponsor"`
	Kpis        string      `json:"kpis"`
	Scope       string      `json:"scope"`
	Initiatives string      `json:"initiatives"`
}

type Querier

type Querier interface {
	// Delete an event by ID
	DeleteEvent(ctx context.Context, eventID pgtype.UUID) error
	// Delete a kpi by ID
	DeleteKpi(ctx context.Context, id pgtype.UUID) error
	// Delete an okr by ID
	DeleteOkr(ctx context.Context, id pgtype.UUID) error
	// Get a single event by ID
	GetEventByID(ctx context.Context, eventID pgtype.UUID) (Event, error)
	// events.sql
	// Get events with pagination and optional search
	GetEvents(ctx context.Context, arg GetEventsParams) ([]Event, error)
	// Get total count for pagination
	GetEventsCount(ctx context.Context, dollar_1 pgtype.Text) (int64, error)
	// Get a single kpi by ID
	GetKpiByID(ctx context.Context, id pgtype.UUID) (Kpi, error)
	// kpis.sql
	// Get kpis
	GetKpis(ctx context.Context, arg GetKpisParams) ([]Kpi, error)
	// Get total count for pagination
	GetKpisCount(ctx context.Context, dollar_1 pgtype.Text) (int64, error)
	// Get a single okr by ID
	GetOkrByID(ctx context.Context, id pgtype.UUID) (GetOkrByIDRow, error)
	// okrs.sql
	// Get okrs with pagination and optional search
	GetOkrs(ctx context.Context, arg GetOkrsParams) ([]GetOkrsRow, error)
	// Get total count for pagination
	GetOkrsCount(ctx context.Context, dollar_1 pgtype.Text) (int64, error)
	// Insert a new event
	InsertEvent(ctx context.Context, arg InsertEventParams) (Event, error)
	// Insert a new key result
	InsertKeyResult(ctx context.Context, arg InsertKeyResultParams) (OkrKr, error)
	// Insert a new kpi
	InsertKpi(ctx context.Context, arg InsertKpiParams) (Kpi, error)
	// Insert a new okr
	InsertOkr(ctx context.Context, arg InsertOkrParams) (InsertOkrRow, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) DeleteEvent

func (q *Queries) DeleteEvent(ctx context.Context, eventID pgtype.UUID) error

Delete an event by ID

func (*Queries) DeleteKpi

func (q *Queries) DeleteKpi(ctx context.Context, id pgtype.UUID) error

Delete a kpi by ID

func (*Queries) DeleteOkr

func (q *Queries) DeleteOkr(ctx context.Context, id pgtype.UUID) error

Delete an okr by ID

func (*Queries) GetEventByID

func (q *Queries) GetEventByID(ctx context.Context, eventID pgtype.UUID) (Event, error)

Get a single event by ID

func (*Queries) GetEvents

func (q *Queries) GetEvents(ctx context.Context, arg GetEventsParams) ([]Event, error)

events.sql Get events with pagination and optional search

func (*Queries) GetEventsCount

func (q *Queries) GetEventsCount(ctx context.Context, dollar_1 pgtype.Text) (int64, error)

Get total count for pagination

func (*Queries) GetKpiByID

func (q *Queries) GetKpiByID(ctx context.Context, id pgtype.UUID) (Kpi, error)

Get a single kpi by ID

func (*Queries) GetKpis

func (q *Queries) GetKpis(ctx context.Context, arg GetKpisParams) ([]Kpi, error)

kpis.sql Get kpis

func (*Queries) GetKpisCount

func (q *Queries) GetKpisCount(ctx context.Context, dollar_1 pgtype.Text) (int64, error)

Get total count for pagination

func (*Queries) GetOkrByID

func (q *Queries) GetOkrByID(ctx context.Context, id pgtype.UUID) (GetOkrByIDRow, error)

Get a single okr by ID

func (*Queries) GetOkrs

func (q *Queries) GetOkrs(ctx context.Context, arg GetOkrsParams) ([]GetOkrsRow, error)

okrs.sql Get okrs with pagination and optional search

func (*Queries) GetOkrsCount

func (q *Queries) GetOkrsCount(ctx context.Context, dollar_1 pgtype.Text) (int64, error)

Get total count for pagination

func (*Queries) InsertEvent

func (q *Queries) InsertEvent(ctx context.Context, arg InsertEventParams) (Event, error)

Insert a new event

func (*Queries) InsertKeyResult

func (q *Queries) InsertKeyResult(ctx context.Context, arg InsertKeyResultParams) (OkrKr, error)

Insert a new key result

func (*Queries) InsertKpi

func (q *Queries) InsertKpi(ctx context.Context, arg InsertKpiParams) (Kpi, error)

Insert a new kpi

func (*Queries) InsertOkr

func (q *Queries) InsertOkr(ctx context.Context, arg InsertOkrParams) (InsertOkrRow, error)

Insert a new okr

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

Jump to

Keyboard shortcuts

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