db

package
v0.0.0-...-e08d004 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentication

type Authentication struct {
	gorm.Model

	UserID uint

	Provider string
	Subject  string

	Email string
}

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

Driver wrapper for a db

func NewDriver

func NewDriver(config *config.Config) (*Driver, error)

func (*Driver) CreateAuthenticationFor

func (d *Driver) CreateAuthenticationFor(user *User) (*Authentication, error)

func (*Driver) CreateUser

func (d *Driver) CreateUser() (*User, error)

func (*Driver) GetUser

func (d *Driver) GetUser(id uint32) (*User, error)

func (*Driver) GetUserFor

func (d *Driver) GetUserFor(auth *Authentication) (*User, error)

func (*Driver) TryGetAuthentication

func (d *Driver) TryGetAuthentication(provider string, subject string) (*Authentication, error)

func (*Driver) UpdateAuthentication

func (d *Driver) UpdateAuthentication(auth *Authentication) error

func (*Driver) UpdateUser

func (d *Driver) UpdateUser(user *User) error

type User

type User struct {
	gorm.Model

	Authentications []Authentication
	PublicData      string
	PrivateData     string
	LastLogin       time.Time
}

func (*User) GetPrivateUserdata

func (u *User) GetPrivateUserdata() (UserData, error)

func (*User) GetPublicUserdata

func (u *User) GetPublicUserdata() (UserData, error)

func (*User) SetPrivateUserdata

func (u *User) SetPrivateUserdata(ud UserData) error

func (*User) SetPublicUserdata

func (u *User) SetPublicUserdata(ud UserData) error

type UserData

type UserData map[string]any

func (*UserData) Scan

func (v *UserData) Scan(value interface{}) error

func (*UserData) Value

func (v *UserData) Value() (string, error)

Jump to

Keyboard shortcuts

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