openauth2models

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2025 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldID               = "id"
	FieldUniqueIdentifier = "unique_identifier"
	FieldData             = "data"
	FieldCreatedAt        = "created_at"
	FieldUpdatedAt        = "updated_at"
	FieldIsAdministrator  = "is_administrator"
	FieldIsActive         = "is_active"
)

These fields are synonymous with the field names in the database table Any update to the database table should be reflected here

Variables

View Source
var (
	Register   = registry.RegisterForDriver
	GetBackend = registry.BackendForDB
)

Functions

func IsValidField

func IsValidField(fieldName string) bool

Types

type Querier

type Querier interface {
	Close() error
	WithTx(tx *sql.Tx) Querier

	RetrieveUsers(ctx context.Context, limit int32, offset int32, ordering ...string) ([]*User, error)
	RetrieveUserByID(ctx context.Context, id uint64) (*User, error)
	RetrieveUserByIdentifier(ctx context.Context, uniqueIdentifier string, providerName string) (*User, error)

	CreateUser(ctx context.Context, uniqueIdentifier string, providerName string, data json.RawMessage, accessToken string, refreshToken string, tokenType string, expiresAt time.Time, isAdministrator bool, isActive bool) (int64, error)
	DeleteUser(ctx context.Context, id uint64) error
	DeleteUsers(ctx context.Context, ids []uint64) error
	UpdateUser(ctx context.Context, providerName string, data json.RawMessage, accessToken string, refreshToken string, tokenType string, expiresAt time.Time, isAdministrator bool, isActive bool, iD uint64) error
}

type SignalsQuerier

type SignalsQuerier struct {
	Querier
}

func (*SignalsQuerier) CreateUser

func (q *SignalsQuerier) CreateUser(ctx context.Context, uniqueIdentifier string, providerName string, data json.RawMessage, accessToken string, refreshToken string, tokenType string, expiresAt time.Time, isAdministrator bool, isActive bool) (int64, error)

func (*SignalsQuerier) DeleteUser

func (q *SignalsQuerier) DeleteUser(ctx context.Context, id uint64) error

func (*SignalsQuerier) DeleteUsers

func (q *SignalsQuerier) DeleteUsers(ctx context.Context, ids []uint64) error

func (*SignalsQuerier) UpdateUser

func (q *SignalsQuerier) UpdateUser(ctx context.Context, providerName string, data json.RawMessage, accessToken string, refreshToken string, tokenType string, expiresAt time.Time, isAdministrator bool, isActive bool, iD uint64) error

type User

type User struct {
	ID               uint64          `json:"id"`
	UniqueIdentifier string          `json:"unique_identifier"`
	ProviderName     string          `json:"provider_name"`
	Data             json.RawMessage `json:"data"`
	AccessToken      string          `json:"access_token"`
	RefreshToken     string          `json:"refresh_token"`
	TokenType        string          `json:"token_type"`
	ExpiresAt        time.Time       `json:"expires_at"`
	CreatedAt        time.Time       `json:"created_at"`
	UpdatedAt        time.Time       `json:"updated_at"`
	IsAdministrator  bool            `json:"is_administrator"`
	IsActive         bool            `json:"is_active"`

	IsLoggedIn bool `json:"is_logged_in"`
	// contains filtered or unexported fields
}

func (*User) Context

func (u *User) Context() context.Context

func (*User) Delete

func (o *User) Delete(ctx context.Context) error

func (*User) FieldDefs

func (o *User) FieldDefs() attrs.Definitions

func (*User) Insert

func (o *User) Insert(ctx context.Context) error

func (*User) IsAdmin

func (u *User) IsAdmin() bool

func (*User) IsAuthenticated

func (u *User) IsAuthenticated() bool

func (*User) Reload

func (o *User) Reload(ctx context.Context) error

func (*User) Save

func (o *User) Save(ctx context.Context) error

func (*User) SetContext

func (u *User) SetContext(ctx context.Context) *User

func (*User) SetToken

func (u *User) SetToken(token *oauth2.Token)

func (*User) String

func (u *User) String() string

func (*User) Token

func (u *User) Token() *oauth2.Token

func (*User) Update

func (o *User) Update(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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