utils

package
v0.0.0-...-46a0a8d Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDbHandle

func GetDbHandle(api_state *APP_STATE) *gorm.DB

func IsNotFiberChild

func IsNotFiberChild(f func())

Run a closure if the current thread is the fiber master thread! This function only exists as we use prefork to decrease our operation times.

Types

type APP_STATE

type APP_STATE struct {
	API_MODE        string
	API_PORT        string
	DATABASE_PATH   string
	LOGGER          *zap.SugaredLogger
	DATABASE_HANDLE *gorm.DB
}

func (*APP_STATE) InitializeDbHandle

func (api_state *APP_STATE) InitializeDbHandle()

Initialize the global database handle.

func (*APP_STATE) InitializeLogger

func (api_state *APP_STATE) InitializeLogger()

Initialize the global logger.

func (*APP_STATE) LoadEnvVars

func (api_state *APP_STATE) LoadEnvVars()

Load the `.env` file relative to the final executable!

type Event

type Event struct {
	ID        uint      `gorm:"primaryKey;autoIncrement:1"`
	CreatedAt time.Time `gorm:"autoCreateTime"`
	// contains filtered or unexported fields
}

Schema models.

type Member

type Member struct {
	ID              uint `gorm:"primaryKey;autoIncrement:1"`
	Email           string
	CreatedAt       time.Time `gorm:"autoCreateTime"`
	UpdatedAt       time.Time `gorm:"autoUpdateTime:milli"`
	EventsAttended  []Event   `gorm:"foreignkey:ID"`
	AttendanceCount int
}

Jump to

Keyboard shortcuts

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