database

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*gorm.DB
}

func OpenDB

func OpenDB(path string) (*DB, error)

type JSON

type JSON[T any] struct {
	Data T
}

func (JSON[T]) GormDataType

func (JSON[T]) GormDataType() string

func (*JSON[T]) Scan

func (m *JSON[T]) Scan(value any) error

func (JSON[T]) Value

func (m JSON[T]) Value() (value driver.Value, err error)

type User

type User struct {
	gorm.Model
	Username   string         `gorm:"column:username"`
	Password   string         `gorm:"column:password"`
	PublicKeys JSON[[]string] `gorm:"column:public_keys;type:text"`
	LastLogin  *time.Time
	Servers    []*UserServer
}

func (User) TableName

func (User) TableName() string

type UserServer

type UserServer struct {
	gorm.Model
	UserID        uint
	LoginUserName string
	LoginPassword *string
	PrivateKey    *string
	ServerAddr    string
	ServerPort    string
	Alias         string
}

func (UserServer) TableName

func (UserServer) TableName() string

Jump to

Keyboard shortcuts

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