db

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REQUEST_EVENT_STATE_HANDLER_EXECUTING = "executing"
	REQUEST_EVENT_STATE_HANDLER_EXECUTED  = "executed"
	REQUEST_EVENT_STATE_HANDLER_ERROR     = "error"
)
View Source
const (
	RESPONSE_EVENT_STATE_PUBLISH_CONFIRMED   = "confirmed"
	RESPONSE_EVENT_STATE_PUBLISH_FAILED      = "failed"
	RESPONSE_EVENT_STATE_PUBLISH_UNCONFIRMED = "unconfirmed"
)

Variables

This section is empty.

Functions

func NewDB

func NewDB(uri string, logDBQueries bool) (*gorm.DB, error)

func NewDBService

func NewDBService(db *gorm.DB, eventPublisher events.EventPublisher) *dbService

func Stop

func Stop(db *gorm.DB) error

Types

type App

type App struct {
	ID          uint
	Name        string `validate:"required"`
	Description string
	NostrPubkey string `validate:"required"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	Isolated    bool
	Metadata    datatypes.JSON
}

type AppPermission

type AppPermission struct {
	ID            uint
	AppId         uint `validate:"required"`
	App           App
	Scope         string `validate:"required"`
	MaxAmountSat  int
	BudgetRenewal string
	ExpiresAt     *time.Time
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

type DBService

type DBService interface {
	CreateApp(name string, pubkey string, maxAmountSat uint64, budgetRenewal string, expiresAt *time.Time, scopes []string, isolated bool, metadata map[string]interface{}) (*App, string, error)
}

type RequestEvent

type RequestEvent struct {
	ID          uint
	AppId       *uint
	App         App
	NostrId     string `validate:"required"`
	ContentData string
	Method      string
	State       string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

type ResponseEvent

type ResponseEvent struct {
	ID        uint
	NostrId   string `validate:"required"`
	RequestId uint   `validate:"required"`
	State     string
	RepliedAt time.Time
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Transaction added in v1.2.0

type Transaction struct {
	ID              uint
	AppId           *uint
	App             *App
	RequestEventId  *uint
	RequestEvent    *RequestEvent
	Type            string
	State           string
	AmountMsat      uint64
	FeeMsat         uint64
	FeeReserveMsat  uint64
	PaymentRequest  string
	PaymentHash     string
	Description     string
	DescriptionHash string
	Preimage        *string
	CreatedAt       time.Time
	ExpiresAt       *time.Time
	UpdatedAt       time.Time
	SettledAt       *time.Time
	Metadata        datatypes.JSON
	SelfPayment     bool
	Boostagram      datatypes.JSON
	FailureReason   string
}

type UserConfig

type UserConfig struct {
	ID        uint
	Key       string
	Value     string
	Encrypted bool
	CreatedAt time.Time
	UpdatedAt time.Time
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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