mcdb

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: MIT Imports: 10 Imported by: 0

README

gomcdb

Materials Commons Database Models in Go

Documentation

Index

Constants

View Source
const SqliteInMemoryDSN = "file::memory:?cache=shared"

Variables

This section is empty.

Functions

func GetDBInstance

func GetDBInstance() *gorm.DB

func MakeDSNFromEnv

func MakeDSNFromEnv() string

func MustConnectToDB

func MustConnectToDB() *gorm.DB

MustConnectToDB will attempt to connect to the database maxDBRetries times. If it isn't successful after that number of retries then it will call log.Fatalf(), which will cause the server to exit. Between retry attempts it will sleep for 3 seconds.

func RunMigrations

func RunMigrations(db *gorm.DB) error

Types

type DatasetFileSelector

type DatasetFileSelector struct {
	DatasetID    int
	IncludeFiles map[string]bool
	ExcludeFiles map[string]bool
	IncludeDirs  map[string]bool
	ExcludeDirs  map[string]bool
	EntityFiles  map[string]bool
}

func NewDatasetFileSelector

func NewDatasetFileSelector(dataset mcmodel.Dataset) *DatasetFileSelector

func (*DatasetFileSelector) IsIncludedDir

func (s *DatasetFileSelector) IsIncludedDir(dirPath string) bool

func (*DatasetFileSelector) IsIncludedFile

func (s *DatasetFileSelector) IsIncludedFile(filePath string) bool

func (*DatasetFileSelector) LoadEntityFiles

func (s *DatasetFileSelector) LoadEntityFiles(db *gorm.DB) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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