database

package
v0.1.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	bun.BaseModel  `bun:"table:file"`
	Key            string        `bun:"key"`
	Size           int64         `bun:"size"`
	Type           string        `bun:"type"`
	OrganizationID int64         `bun:"organization_id"`
	Organization   *Organization `bun:"rel:belongs-to,join:organization_id=id"`
}

type MySQL

type MySQL struct{}

func (*MySQL) Connect

func (r *MySQL) Connect() *bun.DB

type Organization

type Organization struct {
	bun.BaseModel `bun:"table:organization"`
	ID            int64  `bun:"id,pk,autoincrement"`
	Name          string `bun:"name"`
}

not used yet

type OrganizationMember

type OrganizationMember struct {
	bun.BaseModel  `bun:"table:organization_member"`
	ID             int64         `bun:"id,pk,autoincrement"`
	Role           string        `bun:"role"`
	UserID         int           `bun:"user_id"`
	OrganizationID int           `bun:"organization_id"`
	User           *User         `bun:"rel:belongs-to,join:user_id=id"`
	Organization   *Organization `bun:"rel:belongs-to,join:organization_id=id"`
}

not used yet

type PostgreSQL

type PostgreSQL struct{}

func (*PostgreSQL) Connect

func (r *PostgreSQL) Connect() *bun.DB

type Session

type Session struct {
	bun.BaseModel `bun:"table:session"`
	ID            string    `bun:"id,pk"`
	ExpiresAt     time.Time `bun:"expires_at"`
	UserID        int       `bun:"user_id"`
	User          *User     `bun:"rel:belongs-to,join:user_id=id"`
}

type Store

type Store interface {
	Connect() *bun.DB
}

func New

func New(driver string, dsn string) Store

TODO: Return error if driver is not supported

type Token

type Token struct {
	bun.BaseModel `bun:"table:token"`
	ID            int64  `bun:"id,pk,autoincrement"`
	TokenHash     string `bun:"token_hash"`
	Identifier    string `bun:"identifier"`
	UserID        int    `bun:"user_id"`
	User          *User  `bun:"rel:belongs-to,join:user_id=id"`
}

type User

type User struct {
	bun.BaseModel `bun:"table:user"`
	ID            int64  `bun:"id,pk,autoincrement"`
	Name          string `bun:"name"`
	Username      string `bun:"username"`
	Email         string `bun:"email"`
	PasswordHash  string `bun:"password_hash"`
	AuthProvider  string `bun:"auth_provider"`
	AuthID        string `bun:"auth_id"`
	Avatar        string `bun:"avatar"`
	IsAdmin       bool   `bun:"is_admin"`
}

Directories

Path Synopsis
query

Jump to

Keyboard shortcuts

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