database

package
v0.0.0-...-30b40a1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeErrForeign    = "23503"
	CodeErrExists     = "23505"
	CodeErrValidation = "23514"
)
View Source
const (
	NameErrComicLinkPKey  = "comic_link_pkey"
	NameErrComicLinkFKey0 = "comic_link_comic_id_fkey"
	NameErrComicLinkFKey1 = "comic_link_link_id_fkey"
)
View Source
const (
	NameErrComicChapterFKey = "comic_chapter_comic_id_fkey"
	NameErrComicChapterKey  = "comic_chapter_comic_id_chapter_version_key"
)
View Source
const (
	NameErrComicChapterLinkPKey  = "comic_chapter_link_pkey"
	NameErrComicChapterLinkFKey0 = "comic_chapter_link_chapter_id_fkey"
	NameErrComicChapterLinkFKey1 = "comic_chapter_link_link_id_fkey"
)
View Source
const (
	NameErrLinkKey  = "link_website_id_relative_url_key"
	NameErrLinkFKey = "link_website_id_fkey"
)
View Source
const (
	NameErrLinkTLLanguagePKey  = "link_tllanguage_pkey"
	NameErrLinkTLLanguageFKey0 = "link_tllanguage_link_id_fkey"
	NameErrLinkTLLanguageFKey1 = "link_tllanguage_language_id_fkey"
)
View Source
const (
	NameErrWebsiteKey             = "website_domain_key"
	NameErrWebsiteTLLanguagePKey  = "website_tllanguage_pkey"
	NameErrWebsiteTLLanguageFKey0 = "website_tllanguage_website_id_fkey"
	NameErrWebsiteTLLanguageFKey1 = "website_tllanguage_language_id_fkey"
)
View Source
const (
	NameErrComicKey = "comic_code_key"
)
View Source
const (
	NameErrLanguageKey = "language_ietf_key"
)

Variables

This section is empty.

Functions

func SetBulkInsert

func SetBulkInsert(data []map[string]any) (cols string, valx []string, args []any)

func SetInsert

func SetInsert(data map[string]any) (cols string, vals string, args []any)

func SetOrderBy

func SetOrderBy(m model.OrderBy, args *[]any) (ob string)

func SetOrderBys

func SetOrderBys(m model.OrderBys, args *[]any) (obs string)

func SetPagination

func SetPagination(m model.Pagination, args *[]any) (lo string)

func SetUpdate

func SetUpdate(data map[string]any) (sets string, args []any)

func SetUpdateWhere

func SetUpdateWhere(data map[string]any) (cond map[string]any)

func SetValue

func SetValue(val any, args *[]any) string

func SetWhere

func SetWhere(conds any, args *[]any) (cond string)

Types

type Config

type Config struct {
	URL      string `conf:"url"`
	Provider string `conf:"provider"`
}

type Database

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

func New

func New(ctx context.Context, cfg Config) (*Database, error)

func (Database) AddComic

func (db Database) AddComic(ctx context.Context, data model.AddComic, v *model.Comic) error

func (Database) AddComicChapter

func (db Database) AddComicChapter(ctx context.Context, data model.AddComicChapter, v *model.ComicChapter) error
func (db Database) AddComicChapterLink(ctx context.Context, data model.AddComicChapterLink, v *model.ComicChapterLink) error
func (db Database) AddComicLink(ctx context.Context, data model.AddComicLink, v *model.ComicLink) error

func (Database) AddLanguage

func (db Database) AddLanguage(ctx context.Context, data model.AddLanguage, v *model.Language) error
func (db Database) AddLink(ctx context.Context, data model.AddLink, v *model.Link) error

func (Database) AddLinkTLLanguage

func (db Database) AddLinkTLLanguage(ctx context.Context, data model.AddLinkTLLanguage, v *model.LinkTLLanguage) error

func (Database) AddWebsite

func (db Database) AddWebsite(ctx context.Context, data model.AddWebsite, v *model.Website) error

func (Database) AddWebsiteTLLanguage

func (db Database) AddWebsiteTLLanguage(ctx context.Context, data model.AddWebsiteTLLanguage, v *model.WebsiteTLLanguage) error

func (Database) BatchAdd

func (db Database) BatchAdd(ctx context.Context, t string, data []map[string]any, v any) error

func (Database) Close

func (db Database) Close() error

func (Database) CountComic

func (db Database) CountComic(ctx context.Context, conds any) (int, error)

func (Database) CountComicChapter

func (db Database) CountComicChapter(ctx context.Context, conds any) (int, error)
func (db Database) CountComicChapterLink(ctx context.Context, conds any) (int, error)
func (db Database) CountComicLink(ctx context.Context, conds any) (int, error)

func (Database) CountLanguage

func (db Database) CountLanguage(ctx context.Context, conds any) (int, error)
func (db Database) CountLink(ctx context.Context, conds any) (int, error)

func (Database) CountLinkTLLanguage

func (db Database) CountLinkTLLanguage(ctx context.Context, conds any) (int, error)

func (Database) CountWebsite

func (db Database) CountWebsite(ctx context.Context, conds any) (int, error)

func (Database) CountWebsiteTLLanguage

func (db Database) CountWebsiteTLLanguage(ctx context.Context, conds any) (int, error)

func (Database) DeleteComic

func (db Database) DeleteComic(ctx context.Context, conds any, v *model.Comic) error

func (Database) DeleteComicChapter

func (db Database) DeleteComicChapter(ctx context.Context, conds any, v *model.ComicChapter) error
func (db Database) DeleteComicChapterLink(ctx context.Context, conds any, v *model.ComicChapterLink) error
func (db Database) DeleteComicLink(ctx context.Context, conds any, v *model.ComicLink) error

func (Database) DeleteLanguage

func (db Database) DeleteLanguage(ctx context.Context, conds any, v *model.Language) error
func (db Database) DeleteLink(ctx context.Context, conds any, v *model.Link) error

func (Database) DeleteLinkTLLanguage

func (db Database) DeleteLinkTLLanguage(ctx context.Context, conds any, v *model.LinkTLLanguage) error

func (Database) DeleteWebsite

func (db Database) DeleteWebsite(ctx context.Context, conds any, v *model.Website) error

func (Database) DeleteWebsiteTLLanguage

func (db Database) DeleteWebsiteTLLanguage(ctx context.Context, conds any, v *model.WebsiteTLLanguage) error

func (Database) Exec

func (db Database) Exec(ctx context.Context, sql string, args ...any) error

func (Database) ExistsComic

func (db Database) ExistsComic(ctx context.Context, conds any) (bool, error)

func (Database) ExistsComicChapter

func (db Database) ExistsComicChapter(ctx context.Context, conds any) (bool, error)
func (db Database) ExistsLink(ctx context.Context, conds any) (bool, error)

func (Database) ExistsWebsite

func (db Database) ExistsWebsite(ctx context.Context, conds any) (bool, error)

func (Database) GenericAdd

func (db Database) GenericAdd(ctx context.Context, t string, data map[string]any, v any) error

func (Database) GenericCount

func (db Database) GenericCount(ctx context.Context, t string, conds any) (int, error)

func (Database) GenericDelete

func (db Database) GenericDelete(ctx context.Context, t string, conds any, v any) error

func (Database) GenericExists

func (db Database) GenericExists(ctx context.Context, t string, conds any) (bool, error)

func (Database) GenericGet

func (db Database) GenericGet(ctx context.Context, t string, conds any, v any) error

func (Database) GenericList

func (db Database) GenericList(ctx context.Context, t string, params model.ListParams, v any) error

func (Database) GenericUpdate

func (db Database) GenericUpdate(ctx context.Context, t string, data map[string]any, conds any, v any) error

func (Database) GetComic

func (db Database) GetComic(ctx context.Context, conds any) (*model.Comic, error)

func (Database) GetComicChapter

func (db Database) GetComicChapter(ctx context.Context, conds any) (*model.ComicChapter, error)
func (db Database) GetComicChapterLink(ctx context.Context, conds any) (*model.ComicChapterLink, error)
func (db Database) GetComicLink(ctx context.Context, conds any) (*model.ComicLink, error)

func (Database) GetLanguage

func (db Database) GetLanguage(ctx context.Context, conds any) (*model.Language, error)
func (db Database) GetLink(ctx context.Context, conds any) (*model.Link, error)

func (Database) GetLinkTLLanguage

func (db Database) GetLinkTLLanguage(ctx context.Context, conds any) (*model.LinkTLLanguage, error)

func (Database) GetWebsite

func (db Database) GetWebsite(ctx context.Context, conds any) (*model.Website, error)

func (Database) GetWebsiteTLLanguage

func (db Database) GetWebsiteTLLanguage(ctx context.Context, conds any) (*model.WebsiteTLLanguage, error)

func (Database) ListComic

func (db Database) ListComic(ctx context.Context, params model.ListParams) ([]*model.Comic, error)

func (Database) ListComicChapter

func (db Database) ListComicChapter(ctx context.Context, params model.ListParams) ([]*model.ComicChapter, error)
func (db Database) ListComicChapterLink(ctx context.Context, params model.ListParams) ([]*model.ComicChapterLink, error)
func (db Database) ListComicLink(ctx context.Context, params model.ListParams) ([]*model.ComicLink, error)

func (Database) ListLanguage

func (db Database) ListLanguage(ctx context.Context, params model.ListParams) ([]*model.Language, error)
func (db Database) ListLink(ctx context.Context, params model.ListParams) ([]*model.Link, error)

func (Database) ListLinkTLLanguage

func (db Database) ListLinkTLLanguage(ctx context.Context, params model.ListParams) ([]*model.LinkTLLanguage, error)

func (Database) ListWebsite

func (db Database) ListWebsite(ctx context.Context, params model.ListParams) ([]*model.Website, error)

func (Database) ListWebsiteTLLanguage

func (db Database) ListWebsiteTLLanguage(ctx context.Context, params model.ListParams) ([]*model.WebsiteTLLanguage, error)

func (Database) Migrate

func (db Database) Migrate(ctx context.Context, provider string) error

func (Database) QueryAll

func (db Database) QueryAll(ctx context.Context, dst any, sql string, args ...any) error

func (Database) QueryOne

func (db Database) QueryOne(ctx context.Context, dst any, sql string, args ...any) error

func (Database) UpdateComic

func (db Database) UpdateComic(ctx context.Context, data model.SetComic, conds any, v *model.Comic) error

func (Database) UpdateComicChapter

func (db Database) UpdateComicChapter(ctx context.Context, data model.SetComicChapter, conds any, v *model.ComicChapter) error
func (db Database) UpdateComicChapterLink(ctx context.Context, data model.SetComicChapterLink, conds any, v *model.ComicChapterLink) error
func (db Database) UpdateComicLink(ctx context.Context, data model.SetComicLink, conds any, v *model.ComicLink) error

func (Database) UpdateLanguage

func (db Database) UpdateLanguage(ctx context.Context, data model.SetLanguage, conds any, v *model.Language) error
func (db Database) UpdateLink(ctx context.Context, data model.SetLink, conds any, v *model.Link) error

func (Database) UpdateLinkTLLanguage

func (db Database) UpdateLinkTLLanguage(ctx context.Context, data model.SetLinkTLLanguage, conds any, v *model.LinkTLLanguage) error

func (Database) UpdateWebsite

func (db Database) UpdateWebsite(ctx context.Context, data model.SetWebsite, conds any, v *model.Website) error

func (Database) UpdateWebsiteTLLanguage

func (db Database) UpdateWebsiteTLLanguage(ctx context.Context, data model.SetWebsiteTLLanguage, conds any, v *model.WebsiteTLLanguage) error

Jump to

Keyboard shortcuts

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