model

package
v0.0.0-...-4f2e28b Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const SqlstateUniqueViolationState = "23505"

Variables

View Source
var PresentationAlreadyExistsError = errors.New("presentation request already exists")

Functions

func CreateBackupDBEntry

func CreateBackupDBEntry(db *gorm.DB, bidingId string, userId string, name string, creds []byte) error

func CreateOrUpdateUserConfigDbEntry

func CreateOrUpdateUserConfigDbEntry(db *gorm.DB, userId string, attributes map[string]interface{}) error

func CreatePresentationRequestDBEntry

func CreatePresentationRequestDBEntry(db *gorm.DB, userId string, requestId string, ttl int, proofRequestId string) error

func CreateRecordDBEntry

func CreateRecordDBEntry(db *gorm.DB, userId string, event common.RecordEventType, msg string) error

func CreateUserConnectioniDbEntry

func CreateUserConnectioniDbEntry(db *gorm.DB, id string, remoteDid string) error

func CreateUserSecretDbEntry

func CreateUserSecretDbEntry(db *gorm.DB, id string, secretId string)

func CreateUserSecretId

func CreateUserSecretId(userId string) string

func DeleteBackupById

func DeleteBackupById(db *gorm.DB, bindingId string) error

func DeleteInvalidatedBackups

func DeleteInvalidatedBackups(db *gorm.DB, userId string) error

func DeletePresentationRequests

func DeletePresentationRequests(db *gorm.DB, userId string, requestIds []string) error

func DeleteUserConnectioniDbEntry

func DeleteUserConnectioniDbEntry(db *gorm.DB, id string, remoteDid string) error

func EnrichBackupDBEntry

func EnrichBackupDBEntry(db *gorm.DB, bidingId string, creds []byte) error

func WithRecord

func WithRecord(f common.EndpointHandler, ctx *gin.Context, env common.Env, ev common.RecordEventType, msg string) (any, error)

WithRecord Decorator function to execute arbitrary function with populate a database with history record

Types

type Backup

type Backup struct {
	*gorm.Model
	BindingId   sql.NullString `gorm:"binding_id"`
	UserId      string         `gorm:"user_id"`
	Name        string         `gorm:"name"`
	Credentials []byte         `gorm:"credentials"`
}

func GetBackup

func GetBackup(db *gorm.DB, bindingId string) ([]Backup, error)

func GetBackups

func GetBackups(db *gorm.DB, id string, after time.Time) ([]Backup, error)

func GetLastBackup

func GetLastBackup(db *gorm.DB, id string) (Backup, error)

func (*Backup) AfterFind

func (b *Backup) AfterFind(tx *gorm.DB) (err error)

func (*Backup) BeforeUpdate

func (b *Backup) BeforeUpdate(tx *gorm.DB) error

type ContextKey

type ContextKey string
const InvalidateContextKey ContextKey = "invalidate"
const SkipBeforeUpdateHookContextKey ContextKey = "skipHook"

type HistoryRecord

type HistoryRecord struct {
	*gorm.Model
	UserId    string                 `gorm:"user_id"`
	EventType common.RecordEventType `gorm:"event_type"`
	Message   string                 `gorm:"message"`
}

func GetRecords

func GetRecords(db *gorm.DB, userId string) ([]HistoryRecord, error)

type JSONB

type JSONB map[string]interface{}

func (*JSONB) Scan

func (jsonField *JSONB) Scan(value interface{}) error

func (JSONB) Value

func (jsonField JSONB) Value() (driver.Value, error)

type PresentationRequest

type PresentationRequest struct {
	*gorm.Model
	UserId         string `gorm:"user_id"`
	RequestId      string `gorm:"request_id"`
	ProofRequestId string `gorm:"proof_request_id"`
	TTL            int    `gorm:"ttl"`
}

func GetAllPresentationRequests

func GetAllPresentationRequests(db *gorm.DB, userId string) ([]PresentationRequest, error)

func GetPresentationRequestById

func GetPresentationRequestById(db *gorm.DB, userId string, requestId string) (*PresentationRequest, error)

type UserConfig

type UserConfig struct {
	gorm.Model
	UserID     string `gorm:"user_id"`
	Attributes JSONB  `gorm:"type:json;not null;default:'{}'"`
}

func GetConfigByUserID

func GetConfigByUserID(db *gorm.DB, userID string) (*UserConfig, error)

func (*UserConfig) CreateOrUpdateConfig

func (u *UserConfig) CreateOrUpdateConfig(db *gorm.DB) error

type UserConnection

type UserConnection struct {
	*gorm.Model
	UserId    string `gorm:"user_id"`
	RemoteDid string `gorm:"remote_did"`
}

func GetUserConnectionDbEntry

func GetUserConnectionDbEntry(db *gorm.DB, id string, remoteDid string) (*UserConnection, error)

type UserSecret

type UserSecret struct {
	ID        uint `gorm:"autoIncrement; not null; unique; index"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
	// *gorm.Model is not embedded here to avoid colliding with UserId field
	UserId   string `gorm:"user_id; unique; not null; primaryKey"`
	SecretId string `gorm:"secret_id"`
}

func GetUserSecretIdDbEntry

func GetUserSecretIdDbEntry(db *gorm.DB, id string) *UserSecret

Jump to

Keyboard shortcuts

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