postgresql

package
v0.0.0-...-5d14948 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2025 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const OtelName = "github.com/danicc097/openapi-go-gin-postgres-sqlc/internal/repos/postgresql"

Variables

This section is empty.

Functions

func DynamicQuery

func DynamicQuery(d models.DBTX, query string) (string, error)

DynamicQuery returns an SQL query result as JSON.

func GenerateDefaultFilters

func GenerateDefaultFilters(entity models.TableEntity, paginationParams models.PaginationItems) (map[string][]interface{}, error)

GenerateDefaultFilters generates SQL where clauses for a given set of pagination params.

func New

func New(logger *zap.SugaredLogger, options ...Option) (*pgxpool.Pool, *sql.DB, error)

New instantiates the PostgreSQL database using configuration defined in environment variables.

func ParseDBErrorDetail

func ParseDBErrorDetail(err error) error

Types

type Activity

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

Activity represents the repository used for interacting with Activity records.

func NewActivity

func NewActivity() *Activity

NewActivity instantiates the Activity repository.

func (*Activity) ByID

func (*Activity) ByName

func (*Activity) ByProjectID

func (a *Activity) ByProjectID(ctx context.Context, d models.DBTX, projectID models.ProjectID, opts ...models.ActivitySelectConfigOption) ([]models.Activity, error)

func (*Activity) Create

func (*Activity) Delete

func (*Activity) Restore

func (a *Activity) Restore(ctx context.Context, d models.DBTX, id models.ActivityID) error

func (*Activity) Update

type DBOptions

type DBOptions struct {
	DBName string
}

type DemoTwoWorkItem

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

DemoTwoWorkItem represents the repository used for interacting with DemoTwoWorkItem records.

func NewDemoTwoWorkItem

func NewDemoTwoWorkItem() *DemoTwoWorkItem

NewDemoTwoWorkItem instantiates the DemoTwoWorkItem repository.

func (*DemoTwoWorkItem) ByID

func (*DemoTwoWorkItem) Create

func (*DemoTwoWorkItem) Update

type DemoWorkItem

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

DemoWorkItem represents the repository used for interacting with DemoWorkItem records.

func NewDemoWorkItem

func NewDemoWorkItem() *DemoWorkItem

NewDemoWorkItem instantiates the DemoWorkItem repository.

func (*DemoWorkItem) ByID

func (*DemoWorkItem) Create

func (*DemoWorkItem) Update

type KanbanStep

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

KanbanStep represents the repository used for interacting with KanbanStep records.

func NewKanbanStep

func NewKanbanStep() *KanbanStep

NewKanbanStep instantiates the KanbanStep repository.

func (*KanbanStep) ByProject

type Notification

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

Notification represents the repository used for interacting with Notification records.

func NewNotification

func NewNotification() *Notification

NewNotification instantiates the Notification repository.

func (*Notification) Create

func (*Notification) Delete

func (*Notification) LatestNotifications

func (*Notification) PaginatedUserNotifications

func (u *Notification) PaginatedUserNotifications(ctx context.Context, d models.DBTX, userID models.UserID, params models.GetPaginatedNotificationsParams) ([]models.UserNotification, error)

type Option

type Option func(*DBOptions)

func WithDBName

func WithDBName(db string) Option

WithDBName sets the postgres database to connect to.

type Project

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

Project represents the repository used for interacting with Project records.

func NewProject

func NewProject() *Project

NewProject instantiates the Project repository.

func (*Project) ByID

func (*Project) ByName

func (*Project) IsTeamInProject

func (u *Project) IsTeamInProject(ctx context.Context, d models.DBTX, arg models.IsTeamInProjectParams) (bool, error)

func (*Project) UpdateBoardConfig

func (u *Project) UpdateBoardConfig(ctx context.Context, d models.DBTX, projectID models.ProjectID, paths []string, obj any) error

type QuerierWrapper

type QuerierWrapper struct{ _sourceModels.Querier }

QuerierWrapper implements _sourceModels.Querier and wraps errors with the associated query name.

func NewQuerierWrapper

func NewQuerierWrapper(base _sourceModels.Querier) QuerierWrapper

NewQuerierWrapper returns QuerierWrapper with wrapped pgx errors.

func (QuerierWrapper) GetUser

func (QuerierWrapper) IsTeamInProject

type Team

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

Team represents the repository used for interacting with Team records.

func NewTeam

func NewTeam() *Team

NewTeam instantiates the Team repository.

func (*Team) ByID

func (*Team) ByName

func (t *Team) ByName(ctx context.Context, d models.DBTX, name string, projectID models.ProjectID, opts ...models.TeamSelectConfigOption) (*models.Team, error)

func (*Team) Create

func (t *Team) Create(ctx context.Context, d models.DBTX, params *models.TeamCreateParams) (*models.Team, error)

func (*Team) Delete

func (t *Team) Delete(ctx context.Context, d models.DBTX, id models.TeamID) (*models.Team, error)

func (*Team) Update

func (t *Team) Update(ctx context.Context, d models.DBTX, id models.TeamID, params *models.TeamUpdateParams) (*models.Team, error)

type TimeEntry

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

TimeEntry represents the repository used for interacting with TimeEntry records.

func NewTimeEntry

func NewTimeEntry() *TimeEntry

NewTimeEntry instantiates the TimeEntry repository.

func (*TimeEntry) ByID

func (*TimeEntry) Create

func (*TimeEntry) Delete

func (*TimeEntry) Update

type User

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

User represents the repository used for interacting with User records.

func NewUser

func NewUser() *User

NewUser instantiates the User repository.

func (*User) ByAPIKey

func (u *User) ByAPIKey(ctx context.Context, d models.DBTX, apiKey string) (*models.User, error)

func (*User) ByEmail

func (u *User) ByEmail(ctx context.Context, d models.DBTX, email string, opts ...models.UserSelectConfigOption) (*models.User, error)

func (*User) ByExternalID

func (u *User) ByExternalID(ctx context.Context, d models.DBTX, extID string, opts ...models.UserSelectConfigOption) (*models.User, error)

func (*User) ByID

func (*User) ByProject

func (u *User) ByProject(ctx context.Context, d models.DBTX, projectID models.ProjectID) ([]models.User, error)

func (*User) ByTeam

func (u *User) ByTeam(ctx context.Context, d models.DBTX, teamID models.TeamID) ([]models.User, error)

func (*User) ByUsername

func (u *User) ByUsername(ctx context.Context, d models.DBTX, username string, opts ...models.UserSelectConfigOption) (*models.User, error)

func (*User) Create

func (u *User) Create(ctx context.Context, d models.DBTX, params *models.UserCreateParams) (*models.User, error)

func (*User) CreateAPIKey

func (u *User) CreateAPIKey(ctx context.Context, d models.DBTX, user *models.User) (*models.UserAPIKey, error)

func (*User) Delete

func (u *User) Delete(ctx context.Context, d models.DBTX, id models.UserID) (*models.User, error)

func (*User) DeleteAPIKey

func (u *User) DeleteAPIKey(ctx context.Context, d models.DBTX, apiKey string) (*models.UserAPIKey, error)

func (*User) Paginated

func (u *User) Paginated(ctx context.Context, d models.DBTX, params repos.GetPaginatedUsersParams) ([]models.User, error)

func (*User) Update

func (u *User) Update(ctx context.Context, d models.DBTX, id models.UserID, params *models.UserUpdateParams) (*models.User, error)

type WorkItem

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

WorkItem represents the repository used for interacting with WorkItem records.

func NewWorkItem

func NewWorkItem() *WorkItem

NewWorkItem instantiates the WorkItem repository. NOTE: maybe we can consider work item an aggregate root, since we don't need distinction between projects for some tasks like assigning members, tags, generic functionality like Delete, Restore... and this simplifies everything a lot.

func (*WorkItem) AssignTag

func (*WorkItem) AssignUser

func (*WorkItem) ByID

func (*WorkItem) Delete

func (*WorkItem) RemoveAssignedUser

func (w *WorkItem) RemoveAssignedUser(ctx context.Context, d models.DBTX, memberID models.UserID, workItemID models.WorkItemID) error

func (*WorkItem) RemoveTag

func (w *WorkItem) RemoveTag(ctx context.Context, d models.DBTX, tagID models.WorkItemTagID, workItemID models.WorkItemID) error

func (*WorkItem) Restore

func (w *WorkItem) Restore(ctx context.Context, d models.DBTX, id models.WorkItemID) (*models.WorkItem, error)

type WorkItemComment

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

WorkItemComment represents the repository used for interacting with work item comment records.

func NewWorkItemComment

func NewWorkItemComment() *WorkItemComment

NewWorkItemComment instantiates the work item comment repository.

func (*WorkItemComment) Create

func (*WorkItemComment) Delete

type WorkItemTag

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

WorkItemTag represents the repository used for interacting with WorkItemTag records.

func NewWorkItemTag

func NewWorkItemTag() *WorkItemTag

NewWorkItemTag instantiates the WorkItemTag repository.

func (*WorkItemTag) ByName

func (*WorkItemTag) Create

func (*WorkItemTag) Delete

func (*WorkItemTag) Update

type WorkItemType

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

WorkItemType represents the repository used for interacting with WorkItemType records.

func NewWorkItemType

func NewWorkItemType() *WorkItemType

NewWorkItemType instantiates the WorkItemType repository.

func (*WorkItemType) ByName

Directories

Path Synopsis
gen
models
Package models provides primitives to interact with the openapi HTTP API.
Package models provides primitives to interact with the openapi HTTP API.
xo-templates

Jump to

Keyboard shortcuts

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