repositories

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright (C) 2024 Tim Bastin, l3montree UG (haftungsbeschränkt)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAffectedCmpRepository

func NewAffectedCmpRepository(db core.DB) *affectedCmpRepository

func NewAssetRepository

func NewAssetRepository(db core.DB) *assetRepository

func NewCVERepository

func NewCVERepository(db database.DB) *cveRepository

func NewCWERepository

func NewCWERepository(db core.DB) *cweRepository

func NewComponentRepository

func NewComponentRepository(db database.DB) *componentRepository

func NewConfigRepository

func NewConfigRepository(db core.DB) *configRepository

func NewFlawEventRepository

func NewFlawEventRepository(db core.DB) *eventRepository

func NewFlawRepository

func NewFlawRepository(db core.DB) *flawRepository

func NewOrgRepository

func NewOrgRepository(db core.DB) *orgRepository

func NewPATRepository

func NewPATRepository(db core.DB) *gormPatRepository

func NewProjectRepository

func NewProjectRepository(db core.DB) *projectRepository

Types

type GormRepository

type GormRepository[ID comparable, T Tabler] struct {
	// contains filtered or unexported fields
}

func (*GormRepository[ID, T]) Create

func (g *GormRepository[ID, T]) Create(tx *gorm.DB, t *T) error

func (*GormRepository[ID, T]) CreateBatch

func (g *GormRepository[ID, T]) CreateBatch(tx *gorm.DB, ts []T) error

func (*GormRepository[ID, T]) Delete

func (g *GormRepository[ID, T]) Delete(tx *gorm.DB, id ID) error

func (*GormRepository[ID, T]) GetDB

func (g *GormRepository[ID, T]) GetDB(tx *gorm.DB) *gorm.DB

func (*GormRepository[ID, T]) List

func (g *GormRepository[ID, T]) List(ids []ID) ([]T, error)

func (*GormRepository[ID, T]) Read

func (g *GormRepository[ID, T]) Read(id ID) (T, error)

func (*GormRepository[ID, T]) Save

func (g *GormRepository[ID, T]) Save(tx *gorm.DB, t *T) error

func (*GormRepository[ID, T]) SaveBatch

func (g *GormRepository[ID, T]) SaveBatch(tx *gorm.DB, ts []T) error

func (*GormRepository[ID, T]) Transaction

func (g *GormRepository[ID, T]) Transaction(f func(tx *gorm.DB) error) error

type Repository

type Repository[ID any, T Tabler, Tx any] interface {
	Create(tx Tx, t *T) error
	CreateBatch(tx Tx, ts []T) error
	Read(id ID) (T, error)
	Delete(tx Tx, id ID) error
	List(ids []ID) ([]T, error)
	Transaction(func(tx Tx) error) error
	GetDB(tx Tx) Tx
	Save(tx Tx, t *T) error
	SaveBatch(tx Tx, ts []T) error
}

type Tabler

type Tabler interface {
	TableName() string
}

Jump to

Keyboard shortcuts

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