repository

package
v0.0.0-...-8444db5 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound             = errors.New("not found")
	ErrAccountAlreadyExists = errors.New("account already exists")
	ErrAppAlreadyExists     = errors.New("app already exists")
	ErrReleaseAlreadyExists = errors.New("release already exists")
	ErrInvalidVersion       = errors.New("invalid version")
	ErrStaledVersion        = errors.New("staled version")
	ErrForbidden            = errors.New("forbidden")
)

Functions

func Open

func Open(dsn string) (string, *sql.DB, error)

Types

type App

type App struct {
	ID              int64      `db:"id"`
	OwnerID         int64      `db:"owner_id"`
	Owner           *User      `db:"owner" json:",omitempty"`
	Name            string     `db:"name"`
	CreatedAt       time.Time  `db:"created_at"`
	UpdatedAt       time.Time  `db:"updated_at"`
	LatestReleaseID *int64     `db:"latest_release_id" json:",omitempty"`
	LatestRelease   *Release   `db:"latest_release" json:",omitempty"`
	Releases        []*Release `db:"releases" json:",omitempty"`
}

type AppRepository

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

func NewAppRepository

func NewAppRepository(driver string, db *goqu.Database) *AppRepository

func NewAppRepositoryFromDSN

func NewAppRepositoryFromDSN(dsn string) (*AppRepository, func() error, error)

func (*AppRepository) CreateApp

func (r *AppRepository) CreateApp(ctx context.Context, ownerID int64, cid string, archiveFormat bundle.ArchiveExt, appManifest *repository.AppManifest) (int64, error)

func (*AppRepository) CreateRelease

func (r *AppRepository) CreateRelease(ctx context.Context, ownerID, appID int64, cid string, archiveFormat bundle.ArchiveExt, appManifest *repository.AppManifest) (int64, error)

func (*AppRepository) FetchApps

func (r *AppRepository) FetchApps(ctx context.Context, appIDs []int64) ([]*App, error)

func (*AppRepository) FindByID

func (r *AppRepository) FindByID(ctx context.Context, id int64) (*App, error)

func (*AppRepository) ForEachApp

func (r *AppRepository) ForEachApp(ctx context.Context, iterator func(context.Context, *App) error) error

type Release

type Release struct {
	ID            int64     `db:"id"`
	AppID         int64     `db:"app_id"`
	ArchiveFormat string    `db:"archive_format"`
	Version       string    `db:"version"`
	Description   string    `db:"description"`
	CreatedAt     time.Time `db:"created_at"`
	CID           string    `db:"cid"`
}

type User

type User struct {
	ID        int64
	Username  string    `db:"username" json:",omitempty"`
	Email     string    `db:"email" json:",omitempty"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

type UserRepository

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

func NewUserRepository

func NewUserRepository(driver string, db *goqu.Database) *UserRepository

func NewUserRepositoryFromDSN

func NewUserRepositoryFromDSN(dsn string) (*UserRepository, func() error, error)

func (*UserRepository) Authenticate

func (r *UserRepository) Authenticate(ctx context.Context, username string, password string) (bool, error)

func (*UserRepository) Create

func (r *UserRepository) Create(ctx context.Context, username, email, password string) (int64, error)

func (*UserRepository) FindByID

func (r *UserRepository) FindByID(ctx context.Context, id int64) (*User, error)

func (*UserRepository) FindByUsername

func (r *UserRepository) FindByUsername(ctx context.Context, username string) (*User, error)

Jump to

Keyboard shortcuts

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