server

package
v0.0.0-...-10f32d8 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBFilename = "sqlite.db"
)

Variables

This section is empty.

Functions

func CloseDB

func CloseDB(a *App) error

CloseAndSaveDB closes the in-memory database and backup the database file if there is any modification.

func HandleNewTokenInitialization

func HandleNewTokenInitialization(a *App) (string, error)

HandleNewInitialization checks if there is ANY user in the database.

func InitializeDB

func InitializeDB(a *App) (*sql.DB, error)

InitializeDB initializes the database

func PopulateStructWithTables

func PopulateStructWithTables(a *App) error

PopulateStructWithTables updates db struct with tables

func SessionCleaner

func SessionCleaner(a *App, currentTime string) error

SessionCleaner, time as a string

Types

type AccountWrapper

type AccountWrapper struct {
	*db.Account
}

func (*AccountWrapper) ScanFromRows

func (a *AccountWrapper) ScanFromRows(rows *sql.Rows) error

type App

type App struct {
	TemplateFS      fs.FS
	PublicFS        fs.FS
	LocYML          []byte // strings.yml contains the strings for the current language
	DBDir           string
	DBFilename      string
	DBPath          string
	InitialChecksum string
	Config          common.Config
	DB              *sql.DB
	DBTables        DBTables
	StartTime       time.Time
}

func NewServerApp

func NewServerApp(buildConfig *common.BuildConfig) (*App, error)

func (*App) GenerateOauthCallbackURL

func (a *App) GenerateOauthCallbackURL() string

GenerateOauthCallbackURL generates the OAuth callback URL

func (*App) GetUptime

func (a *App) GetUptime() string

func (*App) GetVersionstring

func (a *App) GetVersionstring() string

GetVersion returns the version of the app

func (*App) IsDevEnvironment

func (a *App) IsDevEnvironment() bool

func (*App) StartSessionCleaner

func (a *App) StartSessionCleaner()

StartSessionCleaner initializes the session cleaner to run at regular intervals.

type ClientsWrapper

type ClientsWrapper struct {
	*db.Clients
}

func (*ClientsWrapper) ScanFromRows

func (c *ClientsWrapper) ScanFromRows(rows *sql.Rows) error

type DBTable

type DBTable interface {
	ScanFromRows(rows *sql.Rows) error
}

type DBTables

type DBTables struct {
	User     db.User     `sql:"user"`
	Account  db.Account  `sql:"account"`
	Sessions db.Sessions `sql:"sessions"`
	Provider db.Provider `sql:"provider"`
	Clients  db.Clients  `sql:"clients"`
}

type ProviderWrapper

type ProviderWrapper struct {
	*db.Provider
}

func (*ProviderWrapper) ScanFromRows

func (p *ProviderWrapper) ScanFromRows(rows *sql.Rows) error

type SessionsWrapper

type SessionsWrapper struct {
	*db.Sessions
}

func (*SessionsWrapper) ScanFromRows

func (s *SessionsWrapper) ScanFromRows(rows *sql.Rows) error

type UserWrapper

type UserWrapper struct {
	*db.User
}

func (*UserWrapper) ScanFromRows

func (u *UserWrapper) ScanFromRows(rows *sql.Rows) error

Implementation of DBTable for User, Account, Provider, Sessions

Jump to

Keyboard shortcuts

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