database

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorNilConnection is used when a connection is not available but needed
	ErrorNilConnection = errors.New("connection is nil")
	// ErrorObjectNotFound is used when an object is not found in DB based on given filter
	ErrorObjectNotFound = errors.New("object not found")
	// ErrorDuplicateObject is used when a Serial Number (which is the primary id) is already in the db
	ErrorDuplicateObject = errors.New("object is a duplicate")
)

Functions

This section is empty.

Types

type Certificate

type Certificate struct {
	Meta

	Status           string
	ExpirationDate   time.Time
	RevocationDate   *time.Time
	NameSerialNumber string   `gorm:"unique"`
	SerialNumber     *big.Int `gorm:"unique"`
	CommonName       string
}

Certificate is the struct for the database certificate object

func NewCertificate

func NewCertificate() *Certificate

NewCertificate creates a new Certificate object with a generated ID and settings the CreatedAt and UpdatedAt to now

type CertificateRepository

type CertificateRepository interface {
	GetByNameSerialNumber(nameSerialNumber string) (*Certificate, error)
	Create(certificate *Certificate) error
	DeleteByNameSerialNumber(nameSerialNumber string) error
}

CertificateRepository is the interface for certificate repository implementations

type DB

type DB interface {
	Open() error
	Close() error
	Provision() error

	GetCertificateRepository() CertificateRepository
}

DB is the interface for database implementations

type Meta

type Meta struct {
	UUID      string `gorm:"index"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

Meta is an extra set of recurring data used in database objects

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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