storage_model

package
v0.0.0-...-1dc8ef7 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model interface {
	StorageModel
	db.AutoMigrater
}

func New

func New(db *gorm.DB) Model

type Storage

type Storage struct {
	CreatedAt time.Time
	UpdatedAt time.Time

	StorageId string `gorm:"primaryKey;not null;uniqueIndex"`

	StorageParams `gorm:"embedded"`
}

func (*Storage) BeforeCreate

func (s *Storage) BeforeCreate(tx *gorm.DB) (err error)

type StorageModel

type StorageModel interface {
	CreateStorage(storageParams StorageParams) error
	UpdateStorageByKey(key string, storageParams StorageParams) error
	ReadStorageByKey(key string, isIncludeValue bool) (*Storage, error)
	ReadStorageByKeys(key []string, isIncludeValue bool) ([]*Storage, error)
	ReadAllStorage(isIncludeValue bool) ([]*Storage, error)
	DeleteStorageByKey(key string) (*Storage, error)
	IsExistStorageByKey(key string) (bool, error)
	ReadStoragesByQuery(keys, excludePermission, includePermission []string, isIncludeValue bool) ([]*Storage, error)
}

type StorageParams

type StorageParams struct {
	Key                 string `gorm:"not null;uniqueIndex"`
	Value               string
	NeedPermissions     pq.StringArray `gorm:"type:varchar[]"`
	NeedPermissionCount int
	IsPublic            bool

	Comment string
}

Jump to

Keyboard shortcuts

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