database

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrate

func AutoMigrate(dbc models.DatabaseConfig) error

func ConnectMySQL

func ConnectMySQL(dbconfig models.DatabaseConfig, gormDebug bool) error

func CountAccessions

func CountAccessions() int64

func CountRepositories

func CountRepositories() int64

func CountResources

func CountResources() int64

func CountUsers

func CountUsers() int64

func CreateRepository

func CreateRepository(repository *models.Repository) (uint, error)

func DeleteAccession

func DeleteAccession(id uint) error

func DeleteEntry

func DeleteEntry(id uuid.UUID) error

func DeleteRepository

func DeleteRepository(id uint) error

func DeleteResource

func DeleteResource(id uint) error

func DeleteSessions added in v1.0.6

func DeleteSessions() error

func DeleteToken added in v1.0.6

func DeleteToken(tkn string) error

func DeleteUser

func DeleteUser(id uint) error

func ExpireAPITokensByUserID added in v1.0.5

func ExpireAPITokensByUserID(userID uint) error

func ExpireAllTokens added in v1.0.5

func ExpireAllTokens() error

func ExpireAppTokensByUserID added in v1.0.5

func ExpireAppTokensByUserID(userID uint) error

func ExpireToken added in v1.0.4

func ExpireToken(id uint) error

func ExpireTokensByUserID added in v1.0.5

func ExpireTokensByUserID(userID uint) error

func FindAccession

func FindAccession(id uint) (models.Accession, error)

func FindAccessions

func FindAccessions() ([]models.Accession, error)

func FindAccessionsByResourceID

func FindAccessionsByResourceID(id uint) ([]models.Accession, error)

func FindEntries

func FindEntries() ([]models.Entry, error)

func FindEntriesByAccessionID

func FindEntriesByAccessionID(id uint) ([]models.Entry, error)

func FindEntriesByAccessionIDPaginated added in v1.0.7

func FindEntriesByAccessionIDPaginated(id uint, pagination Pagination) ([]models.Entry, error)

func FindEntriesByRepositoryID added in v1.0.5

func FindEntriesByRepositoryID(repositoryID uint) ([]models.Entry, error)

func FindEntriesByRepositoryIDPaginated added in v1.0.5

func FindEntriesByRepositoryIDPaginated(repositoryID uint, pagination Pagination) ([]models.Entry, error)

func FindEntriesByResourceID

func FindEntriesByResourceID(id uint) ([]models.Entry, error)

func FindEntriesByResourceIDPaginated added in v1.0.5

func FindEntriesByResourceIDPaginated(id uint, pagination Pagination) ([]models.Entry, error)

func FindEntriesPaginated added in v1.0.5

func FindEntriesPaginated(pagination Pagination) ([]models.Entry, error)

func FindEntriesSorted

func FindEntriesSorted(numRecords int) ([]models.Entry, error)

func FindEntry

func FindEntry(id uuid.UUID) (models.Entry, error)

func FindEntryByMediaIDAndCollectionID

func FindEntryByMediaIDAndCollectionID(mediaID uint, ResourceID uint) (uuid.UUID, error)

func FindEntryIDsByAccessionID added in v1.0.5

func FindEntryIDsByAccessionID(id uint) ([]string, error)

func FindEntryIDsByRepositoryID added in v1.0.5

func FindEntryIDsByRepositoryID(repositoryID uint) ([]string, error)

func FindEntryIDsByResourceID added in v1.0.5

func FindEntryIDsByResourceID(id uint) ([]string, error)

func FindEntryInResource

func FindEntryInResource(resourceID int, mediaID int) (string, error)

func FindMaxMediaIDInResource

func FindMaxMediaIDInResource(resourceID uint) int

func FindNextMediaCollectionInResource

func FindNextMediaCollectionInResource(resourceID uint) (uint, error)

func FindPaginatedAccessions

func FindPaginatedAccessions(pagination Pagination) ([]models.Accession, error)

func FindPaginatedEntries

func FindPaginatedEntries(pagination Pagination) ([]models.Entry, error)

func FindPaginatedResources

func FindPaginatedResources(pagination Pagination) ([]models.Resource, error)

func FindRedactedUserByEmail added in v1.0.5

func FindRedactedUserByEmail(email string) (models.User, error)

func FindRepositories

func FindRepositories() ([]models.Repository, error)

func FindRepository

func FindRepository(id uint) (models.Repository, error)

func FindResource

func FindResource(id uint) (models.Resource, error)

func FindResources

func FindResources() ([]models.Resource, error)

func FindResourcesByRepositoryID

func FindResourcesByRepositoryID(repositoryID uint) ([]models.Resource, error)

func FindToken added in v1.0.4

func FindToken(token string) (models.Token, error)

func FindTokenByID added in v1.0.4

func FindTokenByID(id uint) (models.Token, error)

func FindTokensByUserID added in v1.0.5

func FindTokensByUserID(id uint) ([]models.Token, error)

func FindUser

func FindUser(id uint) (models.User, error)

func FindUserByEmail

func FindUserByEmail(email string) (models.User, error)

func FindUserByID

func FindUserByID(id int) (models.User, error)

func FindUserEmailByID

func FindUserEmailByID(id int) (string, error)

func FindUserIDByToken added in v1.0.6

func FindUserIDByToken(token string) (uint, error)

func FindUsers

func FindUsers() ([]models.User, error)

func GetCountOfEntriesInAccession

func GetCountOfEntriesInAccession(accessionID uint) int64

func GetCountOfEntriesInDB

func GetCountOfEntriesInDB() int64

func GetCountOfEntriesInRepository added in v1.0.5

func GetCountOfEntriesInRepository(repositoryID uint) int64

func GetCountOfEntriesInResource

func GetCountOfEntriesInResource(resourceID uint) int64

func GetDB

func GetDB() *gorm.DB

func GetEntriesByDateRange added in v1.0.8

func GetEntriesByDateRange(dr DateRange) ([]models.Entry, error)

func GetEntryIDs added in v1.0.5

func GetEntryIDs() ([]string, error)

func GetEntryIDsPaginated added in v1.0.5

func GetEntryIDsPaginated(pagination Pagination) ([]string, error)

func GetNumberPagesInResource

func GetNumberPagesInResource(resourceID uint) (int, error)

func GetRedactedUser

func GetRedactedUser(id int) (models.User, error)

func GetRepositoryMap

func GetRepositoryMap() (map[int]string, error)

func GetTokens added in v1.0.4

func GetTokens() []models.Token

func InsertAccession

func InsertAccession(accession *models.Accession) (uint, error)

func InsertEntry

func InsertEntry(entry *models.Entry) error

func InsertResource

func InsertResource(resource *models.Resource) (uint, error)

func InsertToken added in v1.0.4

func InsertToken(apiToken *models.Token) error

func InsertUser

func InsertUser(user *models.User) (uint, error)

func IsMediaIDUniqueInResource

func IsMediaIDUniqueInResource(mediaID uint, resourceID uint) (bool, error)

func MigrateDatabase

func MigrateDatabase(rollback bool, dbc models.DatabaseConfig) error

func UpdateAccession

func UpdateAccession(accession *models.Accession) error

func UpdateEntry

func UpdateEntry(entry *models.Entry) error

func UpdateRepository

func UpdateRepository(repository *models.Repository) error

func UpdateResource

func UpdateResource(resource *models.Resource) error

func UpdateToken added in v1.0.4

func UpdateToken(apiToken *models.Token) error

func UpdateUser

func UpdateUser(user *models.User) error

Types

type DateRange

type DateRange struct {
	StartYear    int `form:"start-year"`
	StartMonth   int `form:"start-month"`
	StartDay     int `form:"start-day"`
	EndYear      int `form:"end-year"`
	EndMonth     int `form:"end-month"`
	EndDay       int `form:"end-day"`
	RepositoryID int `form:"repository-id"`
	IsRefreshed  bool
}

func (DateRange) String

func (dr DateRange) String() string

type EntryUser

type EntryUser struct {
	ID    int
	Email string
}

type EntryUsers

type EntryUsers struct {
	CreateUser EntryUser
	UpdateUser EntryUser
}

func FindEntryUsers

func FindEntryUsers(createUserID int, modUserID int) (EntryUsers, error)

type Pagination

type Pagination struct {
	Limit  int    `json:"limit"`
	Offset int    `json:"offset"`
	Sort   string `json:"sort"`
}

type Summaries

type Summaries map[string]Summary

func GetSummaryByAccession

func GetSummaryByAccession(id uint) (Summaries, error)

func GetSummaryByDateRange

func GetSummaryByDateRange(dr DateRange) (Summaries, error)

func GetSummaryByRepository added in v1.0.5

func GetSummaryByRepository(repositoryID uint) (Summaries, error)

func GetSummaryByResource

func GetSummaryByResource(id uint) (Summaries, error)

func GetSummaryByYear

func GetSummaryByYear(year int) (Summaries, error)

func (Summaries) GetSlice added in v1.0.5

func (s Summaries) GetSlice() []Summary

func (Summaries) GetTotals

func (s Summaries) GetTotals() Totals

type Summary

type Summary struct {
	Mediatype string
	Count     int
	Size      float64
	HumanSize string
}

type Totals

type Totals struct {
	Count     int
	Size      float64
	HumanSize string
}

Jump to

Keyboard shortcuts

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