db

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetValue

func GetValue(kv *badger.DB, key string) int

func GetValues

func GetValues(kv *badger.DB, keys []string) (map[string][]byte, error)

func InitKeyVal

func InitKeyVal(dir string) *badger.DB

InitBadger finds and initializes connection to a badger key-value store. If the store does not exist, InitBadger creates it.

func NewDB

func NewDB(cnf config.Config) *sql.DB

func NewDbGorm

func NewDbGorm(cnf config.Config) *gorm.DB

func QuoteString

func QuoteString(s string) string

QuoteString makes a string value compatible with SQL synthax by wrapping it in quotes and escaping internal quotes.

func ResetKeyVal

func ResetKeyVal(dir string) error

func RunQuery

func RunQuery(d *sql.DB, q string) *sql.Rows

func TruncateBHL

func TruncateBHL(d *sql.DB)

func TruncateNames

func TruncateNames(d *sql.DB) error

func TruncateOccur

func TruncateOccur(d *sql.DB) error

Types

type Item

type Item struct {
	ID             uint   `gorm:"primary_key;auto_increment:false"`
	BarCode        string `gorm:"type:varchar(100);unique_index;not null"`
	Vol            string `gorm:"type:varchar(100)"`
	YearStart      sql.NullInt32
	YearEnd        sql.NullInt32
	TitleID        uint   `gorm:"not null"`
	TitleDOI       string `gorm:"type:varchar(100)"`
	TitleName      string `gorm:"type:varchar(255)"`
	TitleAbbr1     string `gorm:"type:varchar(10)"`
	TitleAbbr2     string `gorm:"type:varchar(10)"`
	TitleYearStart sql.NullInt32
	TitleYearEnd   sql.NullInt32
	TitleLang      string `gorm:"type:varchar(20)"`
	PathsTotal     uint
	AnimaliaNum    uint
	PlantaeNum     uint
	FungiNum       uint
	BacteriaNum    uint
	MajorKingdom   string `gorm:"type:varchar(100)"`
	KingdomPercent uint
	Context        string `gorm:"type:varchar(100)"`
}

type NameString

type NameString struct {
	ID                string `sql:"type:uuid;primary_key"`
	Name              string `gorm:"type:varchar(255)"`
	TaxonID           string `gorm:"type:varchar(100)"`
	MatchType         string `gorm:"type:varchar(100)"`
	EditDistance      uint
	StemEditDistance  uint
	MatchedName       string `gorm:"type:varchar(255)"`
	MatchedCanonical  string `gorm:"type:varchar(255);index:canonical"`
	CurrentName       string `gorm:"type:varchar(255)"`
	CurrentCanonical  string `gorm:"type:varchar(255);index:current_canonical"`
	Classification    string
	DataSourceId      sql.NullInt32
	DataSourceTitle   string `gorm:"type:varchar(255)"`
	DataSourcesNumber uint
	Curation          bool `gorm:"index:curation"`
	Occurences        uint
	Odds              float32
	Error             string `gorm:"type:varchar(255)"`
}

type Page

type Page struct {
	ID      uint `gorm:"primary_key;auto_increment:false"`
	ItemID  uint `gorm:"index:item;not null"`
	FileNum uint `gorm:"not null"`
	PageNum sql.NullInt64
}

type PageNameString

type PageNameString struct {
	PageID         uint
	NameStringID   string `sql:"type:uuid;index:name_string"`
	OffsetStart    uint
	OffsetEnd      uint
	Odds           float64
	Annotation     string `gorm:"type:varchar(50)"`
	AnnotationType string `gorm:"type:varchar(50);index:annot"`
}

type Part

type Part struct {
	ID                 uint `gorm:"primary_key;auto_increment:false"`
	PageID             sql.NullInt32
	ItemID             sql.NullInt32
	Length             sql.NullInt32
	DOI                string `gorm:"type:varchar(100)"`
	ContributorName    string `gorm:"type:varchar(255)"`
	SequenceOrder      sql.NullInt32
	SegmentType        string        `gorm:"type:varchar(100)"`
	Title              string        `gorm:"type:text"`
	ContainerTitle     string        `gorm:"type:text"`
	PublicationDetails string        `gorm:"type:text"`
	Volume             string        `gorm:"type:varchar(100)"`
	Series             string        `gorm:"type:varchar(100)"`
	Issue              string        `gorm:"type:varchar(100)"`
	Date               string        `gorm:"type:varchar(100)"`
	Year               sql.NullInt32 `gorm:"index:year"`
	YearEnd            sql.NullInt32
	Month              sql.NullInt32
	Day                sql.NullInt32
	PageNumStart       sql.NullInt32
	PageNumEnd         sql.NullInt32
	Language           string `gorm:"type:varchar(20)"`
}

Jump to

Keyboard shortcuts

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