database

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetConfig

func SetConfig(cfg Config)

Types

type Config

type Config struct {
	Driver         string
	CreateDatabase bool `yaml:"createDatabase"`
	AutoMigrate    bool `yaml:"autoMigrate"`
	Sqlite         struct {
		Path string
	}
	Postgres struct {
		Host     string
		Port     string
		User     string
		Password string
		DbName   string `yaml:"dbName"`
		SSLMode  string `yaml:"sslMode"`
		Opts     string
	}
}

func (*Config) Default

func (c *Config) Default(inContainer bool)

func (*Config) Validate

func (c *Config) Validate() error

Validate ensures all values are valid, and cleans up values (folding, etc.)

type Driver

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

func GetDriver

func GetDriver() (*Driver, error)

func (*Driver) CheckMangaExistence

func (d *Driver) CheckMangaExistence(mangaID string) (bool, error)

func (*Driver) CheckMangaExistenceByPredicate

func (d *Driver) CheckMangaExistenceByPredicate(ps ...predicate.Manga) (bool, error)

func (*Driver) Close

func (d *Driver) Close() error

func (*Driver) CreateChapter

func (d *Driver) CreateChapter(chapterID, num, title string, manga *ent.Manga) error

func (*Driver) CreateManga

func (d *Driver) CreateManga(mangaID, title, source, mapping string, groups []string) (*ent.Manga, error)

func (*Driver) DeleteManga

func (d *Driver) DeleteManga(m *ent.Manga) error

func (*Driver) QueryAllManga

func (d *Driver) QueryAllManga() ([]*ent.Manga, error)

func (*Driver) QueryMangaByID

func (d *Driver) QueryMangaByID(mangaID, source string) (*ent.Manga, error)

func (*Driver) QueryMangaByTitle

func (d *Driver) QueryMangaByTitle(title, source string) (*ent.Manga, error)

func (*Driver) UpdateManga

func (d *Driver) UpdateManga(mangaUpdate *ent.MangaUpdateOne) (*ent.Manga, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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