store

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMaskedToClient    = errors.New("")
	ErrSaveDisabled      = fmt.Errorf("%wsave disabled", ErrMaskedToClient)
	ErrDeleteDisabled    = fmt.Errorf("%wdelete disabled", ErrMaskedToClient)
	ErrDeleteForbidden   = fmt.Errorf("%wdelete forbidden", ErrMaskedToClient)
	ErrNewDeviceDisabled = fmt.Errorf("%wnew devices disabled", ErrMaskedToClient)
)

Functions

This section is empty.

Types

type DBRevision

type DBRevision struct {
	Revision   string `gorm:"primaryKey;autoIncrement:false"`
	Hash       string
	Content    string
	Reason     string
	Device     string `gorm:"primaryKey;autoIncrement:false"`
	Username   string
	Comment    string
	Date       time.Time
	FromPortal bool
}

func (*DBRevision) TableName

func (*DBRevision) TableName() string

func (*DBRevision) ToRevision

func (r *DBRevision) ToRevision() *entity.Revision

type DBStore

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

func NewDBStore

func NewDBStore(dbConfig *db.Configuration, logger *logrus.Entry) (*DBStore, error)

func (DBStore) DeleteRevision

func (D DBStore) DeleteRevision(device string, revisionId string, features config.Features) error

func (DBStore) GetRevision

func (D DBStore) GetRevision(device string, revisionId string, features config.Features) (*entity.Revision, error)

func (DBStore) GetRevisionsForDevice

func (D DBStore) GetRevisionsForDevice(device string, features config.Features) (entity.RevisionList, error)

func (DBStore) SetRevision

func (D DBStore) SetRevision(revision *entity.Revision, features config.Features) error

type DirectoryStore

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

func NewDirectoryStore

func NewDirectoryStore(path string, logger *logrus.Entry) (*DirectoryStore, error)

func (*DirectoryStore) DeleteRevision

func (d *DirectoryStore) DeleteRevision(device string, revisionId string, features config.Features) error

func (*DirectoryStore) GetRevision

func (d *DirectoryStore) GetRevision(device string, revisionId string, features config.Features) (*entity.Revision, error)

func (*DirectoryStore) GetRevisionsForDevice

func (d *DirectoryStore) GetRevisionsForDevice(device string, features config.Features) (entity.RevisionList, error)

func (*DirectoryStore) SetRevision

func (d *DirectoryStore) SetRevision(revision *entity.Revision, features config.Features) error

type Store

type Store interface {
	GetRevisionsForDevice(device string, features config.Features) (entity.RevisionList, error)
	GetRevision(device string, revisionId string, features config.Features) (*entity.Revision, error)
	DeleteRevision(device string, revisionId string, features config.Features) error
	SetRevision(revision *entity.Revision, features config.Features) error
}

type Type added in v1.4.0

type Type string
const DBStoreType Type = "database"
const DirectoryStoreType Type = "directory"

Jump to

Keyboard shortcuts

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