postgres

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type ActivityRepository

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

func NewActivityRepository

func NewActivityRepository(db *gorm.DB) *ActivityRepository

func (*ActivityRepository) BulkUpsert

func (r *ActivityRepository) BulkUpsert(ctx context.Context, activities []*domain.Activity) error

func (*ActivityRepository) Find

func (*ActivityRepository) GetOne

func (r *ActivityRepository) GetOne(ctx context.Context, id string) (*domain.Activity, error)

type AppealRepository

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

AppealRepository talks to the store to read or insert data

func NewAppealRepository

func NewAppealRepository(db *gorm.DB) *AppealRepository

NewAppealRepository returns repository struct

func (*AppealRepository) BulkUpsert

func (r *AppealRepository) BulkUpsert(ctx context.Context, appeals []*domain.Appeal) error

BulkUpsert new record to database

func (*AppealRepository) Find

func (*AppealRepository) GetByID

func (r *AppealRepository) GetByID(ctx context.Context, id string) (*domain.Appeal, error)

GetByID returns appeal record by id along with the approvals and the approvers

func (*AppealRepository) Update

func (r *AppealRepository) Update(ctx context.Context, a *domain.Appeal) error

Update an approval step

type ApprovalRepository

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

func NewApprovalRepository

func NewApprovalRepository(db *gorm.DB) *ApprovalRepository

func (*ApprovalRepository) AddApprover

func (r *ApprovalRepository) AddApprover(ctx context.Context, approver *domain.Approver) error

func (*ApprovalRepository) BulkInsert

func (r *ApprovalRepository) BulkInsert(ctx context.Context, approvals []*domain.Approval) error

func (*ApprovalRepository) DeleteApprover

func (r *ApprovalRepository) DeleteApprover(ctx context.Context, approvalID, email string) error

func (*ApprovalRepository) ListApprovals

func (r *ApprovalRepository) ListApprovals(ctx context.Context, conditions *domain.ListApprovalsFilter) ([]*domain.Approval, error)

type GrantRepository

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

func NewGrantRepository

func NewGrantRepository(db *gorm.DB) *GrantRepository

func (*GrantRepository) BulkInsert

func (r *GrantRepository) BulkInsert(ctx context.Context, grants []*domain.Grant) error

func (*GrantRepository) BulkUpsert

func (r *GrantRepository) BulkUpsert(ctx context.Context, grants []*domain.Grant) error

func (*GrantRepository) GetByID

func (r *GrantRepository) GetByID(ctx context.Context, id string) (*domain.Grant, error)

func (*GrantRepository) List

func (*GrantRepository) Update

func (r *GrantRepository) Update(ctx context.Context, a *domain.Grant) error

type PolicyRepository

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

PolicyRepository talks to the store to read or insert data

func NewPolicyRepository

func NewPolicyRepository(db *gorm.DB) *PolicyRepository

NewPolicyRepository returns repository struct

func (*PolicyRepository) Create

func (r *PolicyRepository) Create(ctx context.Context, p *domain.Policy) error

Create new record to database

func (*PolicyRepository) Find

func (r *PolicyRepository) Find(ctx context.Context) ([]*domain.Policy, error)

Find records based on filters

func (*PolicyRepository) GetOne

func (r *PolicyRepository) GetOne(ctx context.Context, id string, version uint) (*domain.Policy, error)

GetOne returns a policy record based on the id and version params. If version is 0, the latest version will be returned

type ProviderRepository

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

ProviderRepository talks to the store to read or insert data

func NewProviderRepository

func NewProviderRepository(db *gorm.DB) *ProviderRepository

NewProviderRepository returns repository struct

func (*ProviderRepository) Create

Create new record to database

func (*ProviderRepository) Delete

func (r *ProviderRepository) Delete(ctx context.Context, id string) error

Delete record by ID

func (*ProviderRepository) Find

Find records based on filters

func (*ProviderRepository) GetByID

func (r *ProviderRepository) GetByID(ctx context.Context, id string) (*domain.Provider, error)

GetByID record by ID

func (*ProviderRepository) GetOne

func (r *ProviderRepository) GetOne(ctx context.Context, pType, urn string) (*domain.Provider, error)

GetOne returns provider by type and urn

func (*ProviderRepository) GetTypes

func (*ProviderRepository) Update

Update record by ID

type ResourceRepository

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

ResourceRepository talks to the store/database to read/insert data

func NewResourceRepository

func NewResourceRepository(db *gorm.DB) *ResourceRepository

NewResourceRepository returns *Repository

func (*ResourceRepository) BatchDelete

func (r *ResourceRepository) BatchDelete(ctx context.Context, ids []string) error

func (*ResourceRepository) BulkUpsert

func (r *ResourceRepository) BulkUpsert(ctx context.Context, resources []*domain.Resource) error

BulkUpsert inserts records if the records are not exist, or updates the records if they are already exist

func (*ResourceRepository) Delete

func (r *ResourceRepository) Delete(ctx context.Context, id string) error

func (*ResourceRepository) Find

Find records based on filters

func (*ResourceRepository) GetOne

func (r *ResourceRepository) GetOne(ctx context.Context, id string) (*domain.Resource, error)

GetOne record by ID

func (*ResourceRepository) Update

func (r *ResourceRepository) Update(ctx context.Context, res *domain.Resource) error

Update record by ID

type Store

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

func NewStore

func NewStore(c *store.Config) (*Store, error)

func (*Store) DB

func (s *Store) DB() *gorm.DB

func (*Store) Migrate

func (s *Store) Migrate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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