database

package
v0.0.0-...-6b19e2d Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddUserParams

type AddUserParams struct {
	Name          string         `json:"name"`
	Username      string         `json:"username"`
	Password      string         `json:"password"`
	Email         string         `json:"email"`
	EmailVerified bool           `json:"email_verified"`
	Role          types.UserRole `json:"role"`
	UpdatedAt     time.Time      `json:"updated_at"`
	Active        bool           `json:"active"`
}

type CheckLoginResult

type CheckLoginResult struct {
	Subject       string `json:"subject"`
	Name          string `json:"name"`
	HasOtp        bool   `json:"hasTwoFactor"`
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
}

type ClientStore

type ClientStore struct {
	Subject string `json:"subject"`
	Name    string `json:"name"`
	Secret  string `json:"secret"`
	Domain  string `json:"domain"`
	Owner   string `json:"owner"`
	Public  bool   `json:"public"`
	Sso     bool   `json:"sso"`
	Active  bool   `json:"active"`
}

func (*ClientStore) GetDomain

func (c *ClientStore) GetDomain() string

func (*ClientStore) GetID

func (c *ClientStore) GetID() string

func (*ClientStore) GetName

func (c *ClientStore) GetName() string

GetName is an extra field for the oauth handler to display the application name

func (*ClientStore) GetSecret

func (c *ClientStore) GetSecret() string

func (*ClientStore) GetUserID

func (c *ClientStore) GetUserID() string

func (*ClientStore) IsActive

func (c *ClientStore) IsActive() bool

IsActive is an extra field for the app manager to get the active state

func (*ClientStore) IsPublic

func (c *ClientStore) IsPublic() bool

func (*ClientStore) IsSSO

func (c *ClientStore) IsSSO() bool

IsSSO is an extra field for the oauth handler to skip the user input stage this is for trusted applications to get permissions without asking the user

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type GetAppListParams

type GetAppListParams struct {
	Owner   string      `json:"owner"`
	Column2 interface{} `json:"column_2"`
	Offset  int64       `json:"offset"`
}

type GetAppListRow

type GetAppListRow struct {
	Subject string `json:"subject"`
	Name    string `json:"name"`
	Domain  string `json:"domain"`
	Owner   string `json:"owner"`
	Public  bool   `json:"public"`
	Sso     bool   `json:"sso"`
	Active  bool   `json:"active"`
}

type GetOtpRow

type GetOtpRow struct {
	Secret string `json:"secret"`
	Digits int64  `json:"digits"`
}

type GetUserListRow

type GetUserListRow struct {
	Subject       string         `json:"subject"`
	Name          string         `json:"name"`
	Username      string         `json:"username"`
	Picture       string         `json:"picture"`
	Website       string         `json:"website"`
	Email         string         `json:"email"`
	EmailVerified bool           `json:"email_verified"`
	Role          types.UserRole `json:"role"`
	UpdatedAt     time.Time      `json:"updated_at"`
	Active        bool           `json:"active"`
}

type InsertClientAppParams

type InsertClientAppParams struct {
	Subject string `json:"subject"`
	Name    string `json:"name"`
	Secret  string `json:"secret"`
	Domain  string `json:"domain"`
	Owner   string `json:"owner"`
	Public  bool   `json:"public"`
	Sso     bool   `json:"sso"`
	Active  bool   `json:"active"`
}

type ModifyUserParams

type ModifyUserParams struct {
	Name      string            `json:"name"`
	Picture   string            `json:"picture"`
	Website   string            `json:"website"`
	Pronouns  types.UserPronoun `json:"pronouns"`
	Birthdate date.NullDate     `json:"birthdate"`
	Zoneinfo  types.UserZone    `json:"zoneinfo"`
	Locale    types.UserLocale  `json:"locale"`
	UpdatedAt time.Time         `json:"updated_at"`
	Subject   string            `json:"subject"`
}

type Otp

type Otp struct {
	Subject string `json:"subject"`
	Secret  string `json:"secret"`
	Digits  int64  `json:"digits"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AddUser

func (q *Queries) AddUser(ctx context.Context, arg AddUserParams) (string, error)

func (*Queries) ChangePassword

func (q *Queries) ChangePassword(ctx context.Context, subject, newPw string) error

func (*Queries) CheckLogin

func (q *Queries) CheckLogin(ctx context.Context, un, pw string) (CheckLoginResult, error)

func (*Queries) DeleteOtp

func (q *Queries) DeleteOtp(ctx context.Context, subject string) error

func (*Queries) GetAppList

func (q *Queries) GetAppList(ctx context.Context, arg GetAppListParams) ([]GetAppListRow, error)

func (*Queries) GetClientInfo

func (q *Queries) GetClientInfo(ctx context.Context, subject string) (ClientStore, error)

func (*Queries) GetOtp

func (q *Queries) GetOtp(ctx context.Context, subject string) (GetOtpRow, error)

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, subject string) (User, error)

func (*Queries) GetUserDisplayName

func (q *Queries) GetUserDisplayName(ctx context.Context, subject string) (string, error)

func (*Queries) GetUserEmail

func (q *Queries) GetUserEmail(ctx context.Context, subject string) (string, error)

func (*Queries) GetUserList

func (q *Queries) GetUserList(ctx context.Context, offset int64) ([]GetUserListRow, error)

func (*Queries) GetUserRole

func (q *Queries) GetUserRole(ctx context.Context, subject string) (types.UserRole, error)

func (*Queries) HasOtp

func (q *Queries) HasOtp(ctx context.Context, subject string) (bool, error)

func (*Queries) HasUser

func (q *Queries) HasUser(ctx context.Context) (bool, error)

func (*Queries) InsertClientApp

func (q *Queries) InsertClientApp(ctx context.Context, arg InsertClientAppParams) error

func (*Queries) ModifyUser

func (q *Queries) ModifyUser(ctx context.Context, arg ModifyUserParams) error

func (*Queries) ResetClientAppSecret

func (q *Queries) ResetClientAppSecret(ctx context.Context, arg ResetClientAppSecretParams) error

func (*Queries) SetOtp

func (q *Queries) SetOtp(ctx context.Context, arg SetOtpParams) error

func (*Queries) UpdateClientApp

func (q *Queries) UpdateClientApp(ctx context.Context, arg UpdateClientAppParams) error

func (*Queries) UpdateUserRole

func (q *Queries) UpdateUserRole(ctx context.Context, arg UpdateUserRoleParams) error

func (*Queries) UserEmailExists

func (q *Queries) UserEmailExists(ctx context.Context, email string) (bool, error)

func (*Queries) VerifyUserEmail

func (q *Queries) VerifyUserEmail(ctx context.Context, subject string) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type ResetClientAppSecretParams

type ResetClientAppSecretParams struct {
	Secret  string `json:"secret"`
	Subject string `json:"subject"`
	Owner   string `json:"owner"`
}

type SetOtpParams

type SetOtpParams struct {
	Subject string `json:"subject"`
	Secret  string `json:"secret"`
	Digits  int64  `json:"digits"`
}

type UpdateClientAppParams

type UpdateClientAppParams struct {
	Name    string `json:"name"`
	Domain  string `json:"domain"`
	Public  bool   `json:"public"`
	Sso     bool   `json:"sso"`
	Active  bool   `json:"active"`
	Subject string `json:"subject"`
	Owner   string `json:"owner"`
}

type UpdateUserRoleParams

type UpdateUserRoleParams struct {
	Active  bool           `json:"active"`
	Role    types.UserRole `json:"role"`
	Subject string         `json:"subject"`
}

type User

type User struct {
	Subject       string              `json:"subject"`
	Name          string              `json:"name"`
	Username      string              `json:"username"`
	Password      password.HashString `json:"password"`
	Picture       string              `json:"picture"`
	Website       string              `json:"website"`
	Email         string              `json:"email"`
	EmailVerified bool                `json:"email_verified"`
	Pronouns      types.UserPronoun   `json:"pronouns"`
	Birthdate     date.NullDate       `json:"birthdate"`
	Zoneinfo      types.UserZone      `json:"zoneinfo"`
	Locale        types.UserLocale    `json:"locale"`
	Role          types.UserRole      `json:"role"`
	UpdatedAt     time.Time           `json:"updated_at"`
	Registered    time.Time           `json:"registered"`
	Active        bool                `json:"active"`
}

type UserPatch

type UserPatch struct {
	Name      string
	Picture   string
	Website   string
	Pronouns  types.UserPronoun
	Birthdate date.NullDate
	ZoneInfo  types.UserZone
	Locale    types.UserLocale
}

func (*UserPatch) ParseFromForm

func (u *UserPatch) ParseFromForm(v url.Values) (safeErrs []error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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