repository

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GormRepository

type GormRepository struct {
	// gorm db connection.
	Db *gorm.DB
	// contains filtered or unexported fields
}

func NewGormRepository

func NewGormRepository(db *gorm.DB, logger *zap.Logger) *GormRepository

func (*GormRepository) Create

func (r *GormRepository) Create(record metav1.Resource) error

func (*GormRepository) Exist

func (r *GormRepository) Exist(conditions interface{}) (bool, error)

func (*GormRepository) Find

func (r *GormRepository) Find(conditions interface{}) (record metav1.Resource, err error)

func (*GormRepository) FindAll

func (r *GormRepository) FindAll(conditions interface{}) (records []metav1.Resource, err error)

func (*GormRepository) Get

func (r *GormRepository) Get(id int) (record metav1.Resource, err error)

type Repository

type Repository interface {
	// Get returns the record for the given id.
	Get(id int) (record metav1.Resource, err error)
	// Find return one record filter by the conditions.
	Find(conditions interface{}) (record metav1.Resource, err error)
	// FindAll return all records filter by the conditions.
	FindAll(conditions interface{}) (records []metav1.Resource, err error)

	// Exist return one record does exist in table.
	Exist(conditions interface{}) (bool, error)

	// Create record.
	Create(record metav1.Resource) error
}

Repository is an interface for a repository.

Jump to

Keyboard shortcuts

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