postgres

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package postgres contains the database implementation of clients repository layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PageQuery

func PageQuery(pm clients.Page) (string, error)

func ToClient

func ToClient(c DBClient) (clients.Client, error)

func ToDBClientsPage

func ToDBClientsPage(pm clients.Page) (dbClientsPage, error)

Types

type DBClient

type DBClient struct {
	ID        string           `db:"id"`
	Name      string           `db:"name,omitempty"`
	Tags      pgtype.TextArray `db:"tags,omitempty"`
	Identity  string           `db:"identity"`
	Domain    string           `db:"domain_id"`
	Secret    string           `db:"secret"`
	Metadata  []byte           `db:"metadata,omitempty"`
	CreatedAt time.Time        `db:"created_at,omitempty"`
	UpdatedAt sql.NullTime     `db:"updated_at,omitempty"`
	UpdatedBy *string          `db:"updated_by,omitempty"`
	Groups    []groups.Group   `db:"groups,omitempty"`
	Status    clients.Status   `db:"status,omitempty"`
	Role      *clients.Role    `db:"role,omitempty"`
}

func ToDBClient

func ToDBClient(c clients.Client) (DBClient, error)

type Repository

type Repository struct {
	DB postgres.Database
}

func (*Repository) ChangeStatus

func (repo *Repository) ChangeStatus(ctx context.Context, client clients.Client) (clients.Client, error)

func (*Repository) RetrieveAll

func (repo *Repository) RetrieveAll(ctx context.Context, pm clients.Page) (clients.ClientsPage, error)

func (*Repository) RetrieveAllBasicInfo

func (repo *Repository) RetrieveAllBasicInfo(ctx context.Context, pm clients.Page) (clients.ClientsPage, error)

func (*Repository) RetrieveAllByIDs

func (repo *Repository) RetrieveAllByIDs(ctx context.Context, pm clients.Page) (clients.ClientsPage, error)

func (*Repository) RetrieveByID

func (repo *Repository) RetrieveByID(ctx context.Context, id string) (clients.Client, error)

func (*Repository) RetrieveByIdentity

func (repo *Repository) RetrieveByIdentity(ctx context.Context, identity string) (clients.Client, error)

func (*Repository) Update

func (repo *Repository) Update(ctx context.Context, client clients.Client) (clients.Client, error)

func (*Repository) UpdateIdentity

func (repo *Repository) UpdateIdentity(ctx context.Context, client clients.Client) (clients.Client, error)

func (*Repository) UpdateRole

func (repo *Repository) UpdateRole(ctx context.Context, client clients.Client) (clients.Client, error)

func (*Repository) UpdateSecret

func (repo *Repository) UpdateSecret(ctx context.Context, client clients.Client) (clients.Client, error)

func (*Repository) UpdateTags

func (repo *Repository) UpdateTags(ctx context.Context, client clients.Client) (clients.Client, error)

Jump to

Keyboard shortcuts

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