database

package
v0.0.0-...-d3f97d4 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(dsn string) *gorm.DB

func InitRedis

func InitRedis(url string) *redis.Client

Types

type FnStatusCode

type FnStatusCode int
const (
	FnReady FnStatusCode = iota
	FnRunning
	FnUnknownState
)

type Function

type Function struct {
	ID             uuid.UUID `json:"id" ,gorm:"primarykey;type:uuid;default:gen_random_uuid()"`
	Name           string    `json:"name"`
	Description    string    `json:"description"`
	Language       string    `json:"language"`
	Built          bool      `json:"built"`           // The builder has built the image for this function
	BuildTimestamp int64     `json:"build_timestamp"` // The timestamp of the last build in Unix time

	OwnerID int  `json:"owner_id"`
	Owner   User `json:"-"`
}

type FunctionState

type FunctionState struct {
	ID       string `redis:"id"`
	Address  string `redis:"address"`
	Port     uint16 `redis:"port"`
	Status   int    `redis:"status"`
	LastUsed string `redis:"lastUsed"`
}

This struct represents an instance of a function, especially it's address and status Each key in the redis is namespaced as it follows: <id of the function>:<id of the instance>

type User

type User struct {
	gorm.Model
	Username       string
	HashedPassword string
}

Jump to

Keyboard shortcuts

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