gorm2

package
v0.0.0-...-533d78a Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSQLDb

func GetSQLDb(repo *Repository) (*sql.DB, error)

Types

type Config

type Config struct {
	Hostname string
	Port     int
	Username string
	Password string
	Database string
}

func GetGorm2Config

func GetGorm2Config(c *config.Config) *Config

type Repository

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

func NewGorm2Repository

func NewGorm2Repository(c *Config) (*Repository, error)

func (*Repository) DeleteDialogue

func (repo *Repository) DeleteDialogue(ctx context.Context, id ulid.ULID) error

func (*Repository) DeleteLine

func (repo *Repository) DeleteLine(ctx context.Context, id ulid.ULID) error

func (*Repository) DeleteProject

func (repo *Repository) DeleteProject(ctx context.Context, id ulid.ULID) error

func (*Repository) Do

func (repo *Repository) Do(ctx context.Context, options *sql.TxOptions, callBack func(context.Context) error) error

func (*Repository) InsertDialogue

func (repo *Repository) InsertDialogue(
	ctx context.Context,
	id ulid.ULID,
	pageID ulid.ULID,
	dialogue string,
	top float64,
	bottom float64,
	left float64,
	right float64,
) (*repository.Dialogue, error)

func (*Repository) InsertLine

func (repo *Repository) InsertLine(ctx context.Context, id ulid.ULID, pageID ulid.ULID, penSize int, points repository.Points) (*repository.Line, error)

func (*Repository) InsertPage

func (repo *Repository) InsertPage(ctx context.Context, id ulid.ULID, projectID ulid.ULID, height int, width int) (*repository.Page, error)

func (*Repository) InsertProject

func (repo *Repository) InsertProject(ctx context.Context, id ulid.ULID, name string, thumbnail string) (*repository.Project, error)

func (*Repository) SelectDialogues

func (repo *Repository) SelectDialogues(ctx context.Context, pageID ulid.ULID) ([]*repository.Dialogue, error)

func (*Repository) SelectLines

func (repo *Repository) SelectLines(ctx context.Context, pageID ulid.ULID) ([]*repository.Line, error)

func (*Repository) SelectPage

func (repo *Repository) SelectPage(ctx context.Context, id ulid.ULID) (*repository.Page, error)

func (*Repository) SelectProject

func (repo *Repository) SelectProject(ctx context.Context, id ulid.ULID) (*repository.Project, error)

func (*Repository) SelectProjectPageNum

func (repo *Repository) SelectProjectPageNum(ctx context.Context, projectID ulid.ULID) (int, error)

func (*Repository) SelectProjectPages

func (repo *Repository) SelectProjectPages(ctx context.Context, projectID ulid.ULID) ([]*repository.Page, error)

func (*Repository) SelectProjects

func (repo *Repository) SelectProjects(ctx context.Context) ([]*repository.Project, error)

func (*Repository) UpdateDialogue

func (repo *Repository) UpdateDialogue(
	ctx context.Context,
	id ulid.ULID,
	dialogue string,
	top float64,
	bottom float64,
	left float64,
	right float64,
) (*repository.Dialogue, error)

func (*Repository) UpdateIndex

func (repo *Repository) UpdateIndex(ctx context.Context, id ulid.ULID, operation string) (*repository.Page, error)

func (*Repository) UpdateProject

func (repo *Repository) UpdateProject(ctx context.Context, id ulid.ULID, name string) (*repository.Project, error)

Jump to

Keyboard shortcuts

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