program

package
v0.0.0-...-a6e234c Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMigrationsTableNotFound = errors.New("migrations table not found")
)

Functions

func MysqlDSN

func MysqlDSN(addr, user, password, dbName string) string

MysqlDSN returns a DSN that could be used to connect to a MySQL database. You may want to append mysql:// to the beginning of the returned string.

Types

type MigrationsStatus

type MigrationsStatus struct {
	Version int `json:"version"`
	Dirty   int `json:"dirty"`
}

type Program

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

func NewProgram

func NewProgram(openDatabase bool) (*Program, error)

func (*Program) AddAllUsersToCommunity

func (pg *Program) AddAllUsersToCommunity(community string) error

func (*Program) ChangeUserPassword

func (pg *Program) ChangeUserPassword(user, password string) error

func (*Program) Close

func (pg *Program) Close() error

func (*Program) Config

func (pg *Program) Config() *config.Config

func (*Program) DeleteUnusedCommunities

func (pg *Program) DeleteUnusedCommunities(days uint, dryRun bool) error

func (*Program) DeleteUser

func (pg *Program) DeleteUser(user string, purge bool) error

func (*Program) FixPostHotScores

func (pg *Program) FixPostHotScores() error

func (*Program) HardReset

func (pg *Program) HardReset() error

func (*Program) MakeUserAdmin

func (pg *Program) MakeUserAdmin(username string, isAdmin bool) error

func (*Program) MakeUserMod

func (pg *Program) MakeUserMod(community, user string, isMod bool) error

func (*Program) Migrate

func (pg *Program) Migrate(log bool, steps int) error

If steps is 0, all migrations are run. Otherwise, steps migrations are run up or down depending on steps > 0 or not.

func (*Program) MigrationsStatus

func (pg *Program) MigrationsStatus() (MigrationsStatus, error)

MigrationsStatus returns the status of the current database migrations. If the migrations table is not found, ErrMigrationsTableNotFound is returned. If the migrations table is found but it's empty, sql.ErrNoRows is returned.

func (*Program) NewBadgeType

func (pg *Program) NewBadgeType(name string) error

func (*Program) OpenDatabase

func (pg *Program) OpenDatabase() (*sql.DB, error)

OpenDatabase opens the database. If it was opened previously, the existing sql.DB object is returned.

func (*Program) Serve

func (pg *Program) Serve() error

Jump to

Keyboard shortcuts

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