store

package
v0.4.27 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.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 AccessGrant added in v0.4.26

type AccessGrant struct {
	Model
	ShareId   int
	AccountId int
}

type Account

type Account struct {
	Model
	Email     string
	Salt      string
	Password  string
	Token     string
	Limitless bool
	Deleted   bool
}

type AccountLimitJournal added in v0.4.0

type AccountLimitJournal struct {
	Model
	AccountId int
	RxBytes   int64
	TxBytes   int64
	Action    LimitJournalAction
}

type AccountRequest

type AccountRequest struct {
	Model
	Token         string
	Email         string
	SourceAddress string
	Deleted       bool
}

type Config

type Config struct {
	Path string `cf:"+secret"`
	Type string
}

type Environment

type Environment struct {
	Model
	AccountId   *int
	Description string
	Host        string
	Address     string
	ZId         string
	Deleted     bool
}

type EnvironmentLimitJournal added in v0.4.0

type EnvironmentLimitJournal struct {
	Model
	EnvironmentId int
	RxBytes       int64
	TxBytes       int64
	Action        LimitJournalAction
}

type Frontend

type Frontend struct {
	Model
	EnvironmentId  *int
	PrivateShareId *int
	Token          string
	ZId            string
	PublicName     *string
	UrlTemplate    *string
	Reserved       bool
	Deleted        bool
}

type InviteToken

type InviteToken struct {
	Model
	Token   string
	Deleted bool
}

type LimitJournalAction added in v0.4.0

type LimitJournalAction string
const (
	LimitAction   LimitJournalAction = "limit"
	WarningAction LimitJournalAction = "warning"
	ClearAction   LimitJournalAction = "clear"
)

type Model

type Model struct {
	Id        int
	CreatedAt time.Time
	UpdatedAt time.Time
	Deleted   bool
}

type PasswordResetRequest

type PasswordResetRequest struct {
	Model
	Token     string
	AccountId int
	Deleted   bool
}

type PermissionMode added in v0.4.26

type PermissionMode string
const (
	OpenPermissionMode   PermissionMode = "open"
	ClosedPermissionMode PermissionMode = "closed"
)

type Share

type Share struct {
	Model
	EnvironmentId        int
	ZId                  string
	Token                string
	ShareMode            string
	BackendMode          string
	FrontendSelection    *string
	FrontendEndpoint     *string
	BackendProxyEndpoint *string
	Reserved             bool
	PermissionMode       PermissionMode
	Deleted              bool
}

type ShareLimitJournal added in v0.4.0

type ShareLimitJournal struct {
	Model
	ShareId int
	RxBytes int64
	TxBytes int64
	Action  LimitJournalAction
}

type Store

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

func Open

func Open(cfg *Config) (*Store, error)

func (*Store) Begin

func (str *Store) Begin() (*sqlx.Tx, error)

func (*Store) CheckAccessGrantForShareAndAccount added in v0.4.26

func (str *Store) CheckAccessGrantForShareAndAccount(shrId, acctId int, tx *sqlx.Tx) (int, error)

func (*Store) Close

func (str *Store) Close() error

func (*Store) CreateAccessGrant added in v0.4.26

func (str *Store) CreateAccessGrant(shareId, accountId int, tx *sqlx.Tx) (int, error)

func (*Store) CreateAccount

func (str *Store) CreateAccount(a *Account, tx *sqlx.Tx) (int, error)

func (*Store) CreateAccountLimitJournal added in v0.4.0

func (str *Store) CreateAccountLimitJournal(j *AccountLimitJournal, trx *sqlx.Tx) (int, error)

func (*Store) CreateAccountRequest

func (str *Store) CreateAccountRequest(ar *AccountRequest, tx *sqlx.Tx) (int, error)

func (*Store) CreateEnvironment

func (str *Store) CreateEnvironment(accountId int, i *Environment, tx *sqlx.Tx) (int, error)

func (*Store) CreateEnvironmentLimitJournal added in v0.4.0

func (str *Store) CreateEnvironmentLimitJournal(j *EnvironmentLimitJournal, trx *sqlx.Tx) (int, error)

func (*Store) CreateEphemeralEnvironment

func (str *Store) CreateEphemeralEnvironment(i *Environment, tx *sqlx.Tx) (int, error)

func (*Store) CreateFrontend

func (str *Store) CreateFrontend(envId int, f *Frontend, tx *sqlx.Tx) (int, error)

func (*Store) CreateGlobalFrontend

func (str *Store) CreateGlobalFrontend(f *Frontend, tx *sqlx.Tx) (int, error)

func (*Store) CreateInviteTokens

func (str *Store) CreateInviteTokens(inviteTokens []*InviteToken, tx *sqlx.Tx) error

func (*Store) CreatePasswordResetRequest

func (str *Store) CreatePasswordResetRequest(prr *PasswordResetRequest, tx *sqlx.Tx) (int, error)

func (*Store) CreateShare

func (str *Store) CreateShare(envId int, shr *Share, tx *sqlx.Tx) (int, error)

func (*Store) CreateShareLimitJournal added in v0.4.0

func (str *Store) CreateShareLimitJournal(j *ShareLimitJournal, trx *sqlx.Tx) (int, error)

func (*Store) DeleteAccessGrantsForShare added in v0.4.26

func (str *Store) DeleteAccessGrantsForShare(shrId int, tx *sqlx.Tx) error

func (*Store) DeleteAccessGrantsForShareAndAccount added in v0.4.26

func (str *Store) DeleteAccessGrantsForShareAndAccount(shrId, acctId int, tx *sqlx.Tx) error

func (*Store) DeleteAccountLimitJournalForAccount added in v0.4.0

func (str *Store) DeleteAccountLimitJournalForAccount(acctId int, trx *sqlx.Tx) error

func (*Store) DeleteAccountRequest

func (str *Store) DeleteAccountRequest(id int, tx *sqlx.Tx) error

func (*Store) DeleteEnvironment

func (str *Store) DeleteEnvironment(id int, tx *sqlx.Tx) error

func (*Store) DeleteEnvironmentLimitJournalForEnvironment added in v0.4.0

func (str *Store) DeleteEnvironmentLimitJournalForEnvironment(envId int, trx *sqlx.Tx) error

func (*Store) DeleteFrontend

func (str *Store) DeleteFrontend(id int, tx *sqlx.Tx) error

func (*Store) DeleteInviteToken

func (str *Store) DeleteInviteToken(id int, tx *sqlx.Tx) error

func (*Store) DeleteMultipleAccountRequests

func (str *Store) DeleteMultipleAccountRequests(ids []int, tx *sqlx.Tx) error

func (*Store) DeleteMultiplePasswordResetRequests

func (str *Store) DeleteMultiplePasswordResetRequests(ids []int, tx *sqlx.Tx) error

func (*Store) DeletePasswordResetRequest

func (str *Store) DeletePasswordResetRequest(id int, tx *sqlx.Tx) error

func (*Store) DeletePasswordResetRequestsByAccountId added in v0.4.25

func (str *Store) DeletePasswordResetRequestsByAccountId(accountId int, tx *sqlx.Tx) error

func (*Store) DeleteShare

func (str *Store) DeleteShare(id int, tx *sqlx.Tx) error

func (*Store) DeleteShareLimitJournalForShare added in v0.4.0

func (str *Store) DeleteShareLimitJournalForShare(shrId int, trx *sqlx.Tx) error

func (*Store) FindAccountRequestWithEmail

func (str *Store) FindAccountRequestWithEmail(email string, tx *sqlx.Tx) (*AccountRequest, error)

func (*Store) FindAccountRequestWithToken

func (str *Store) FindAccountRequestWithToken(token string, tx *sqlx.Tx) (*AccountRequest, error)

func (*Store) FindAccountWithEmail

func (str *Store) FindAccountWithEmail(email string, tx *sqlx.Tx) (*Account, error)

func (*Store) FindAccountWithEmailAndDeleted added in v0.4.0

func (str *Store) FindAccountWithEmailAndDeleted(email string, tx *sqlx.Tx) (*Account, error)

func (*Store) FindAccountWithToken

func (str *Store) FindAccountWithToken(token string, tx *sqlx.Tx) (*Account, error)

func (*Store) FindAllLatestAccountLimitJournal added in v0.4.0

func (str *Store) FindAllLatestAccountLimitJournal(trx *sqlx.Tx) ([]*AccountLimitJournal, error)

func (*Store) FindAllLatestEnvironmentLimitJournal added in v0.4.0

func (str *Store) FindAllLatestEnvironmentLimitJournal(trx *sqlx.Tx) ([]*EnvironmentLimitJournal, error)

func (*Store) FindAllLatestShareLimitJournal added in v0.4.0

func (str *Store) FindAllLatestShareLimitJournal(trx *sqlx.Tx) ([]*ShareLimitJournal, error)

func (*Store) FindAllShares added in v0.4.0

func (str *Store) FindAllShares(tx *sqlx.Tx) ([]*Share, error)

func (*Store) FindEnvironmentForAccount

func (str *Store) FindEnvironmentForAccount(envZId string, accountId int, tx *sqlx.Tx) (*Environment, error)

func (*Store) FindEnvironmentsForAccount

func (str *Store) FindEnvironmentsForAccount(accountId int, tx *sqlx.Tx) ([]*Environment, error)

func (*Store) FindExpiredAccountRequests

func (str *Store) FindExpiredAccountRequests(before time.Time, limit int, tx *sqlx.Tx) ([]*AccountRequest, error)

func (*Store) FindExpiredPasswordResetRequests

func (str *Store) FindExpiredPasswordResetRequests(before time.Time, limit int, tx *sqlx.Tx) ([]*PasswordResetRequest, error)

func (*Store) FindFrontendPubliclyNamed

func (str *Store) FindFrontendPubliclyNamed(publicName string, tx *sqlx.Tx) (*Frontend, error)

func (*Store) FindFrontendWithToken

func (str *Store) FindFrontendWithToken(token string, tx *sqlx.Tx) (*Frontend, error)

func (*Store) FindFrontendWithZId

func (str *Store) FindFrontendWithZId(zId string, tx *sqlx.Tx) (*Frontend, error)

func (*Store) FindFrontendsForEnvironment

func (str *Store) FindFrontendsForEnvironment(envId int, tx *sqlx.Tx) ([]*Frontend, error)

func (*Store) FindFrontendsForPrivateShare added in v0.4.0

func (str *Store) FindFrontendsForPrivateShare(shrId int, tx *sqlx.Tx) ([]*Frontend, error)

func (*Store) FindInviteTokenByToken added in v0.4.0

func (str *Store) FindInviteTokenByToken(token string, tx *sqlx.Tx) (*InviteToken, error)

func (*Store) FindLatestAccountLimitJournal added in v0.4.0

func (str *Store) FindLatestAccountLimitJournal(acctId int, trx *sqlx.Tx) (*AccountLimitJournal, error)

func (*Store) FindLatestEnvironmentLimitJournal added in v0.4.0

func (str *Store) FindLatestEnvironmentLimitJournal(envId int, trx *sqlx.Tx) (*EnvironmentLimitJournal, error)

func (*Store) FindLatestShareLimitJournal added in v0.4.0

func (str *Store) FindLatestShareLimitJournal(shrId int, trx *sqlx.Tx) (*ShareLimitJournal, error)

func (*Store) FindPasswordResetRequestWithToken

func (str *Store) FindPasswordResetRequestWithToken(token string, tx *sqlx.Tx) (*PasswordResetRequest, error)

func (*Store) FindPublicFrontends

func (str *Store) FindPublicFrontends(tx *sqlx.Tx) ([]*Frontend, error)

func (*Store) FindSelectedLatestEnvironmentLimitJournal added in v0.4.0

func (str *Store) FindSelectedLatestEnvironmentLimitJournal(envIds []int, trx *sqlx.Tx) ([]*EnvironmentLimitJournal, error)

func (*Store) FindSelectedLatestShareLimitjournal added in v0.4.0

func (str *Store) FindSelectedLatestShareLimitjournal(shrIds []int, trx *sqlx.Tx) ([]*ShareLimitJournal, error)

func (*Store) FindShareWithToken

func (str *Store) FindShareWithToken(shrToken string, tx *sqlx.Tx) (*Share, error)

func (*Store) FindShareWithZIdAndDeleted added in v0.4.0

func (str *Store) FindShareWithZIdAndDeleted(zId string, tx *sqlx.Tx) (*Share, error)

func (*Store) FindSharesForEnvironment

func (str *Store) FindSharesForEnvironment(envId int, tx *sqlx.Tx) ([]*Share, error)

func (*Store) GetAccount

func (str *Store) GetAccount(id int, tx *sqlx.Tx) (*Account, error)

func (*Store) GetAccountRequest

func (str *Store) GetAccountRequest(id int, tx *sqlx.Tx) (*AccountRequest, error)

func (*Store) GetEnvironment

func (str *Store) GetEnvironment(id int, tx *sqlx.Tx) (*Environment, error)

func (*Store) GetFrontend

func (str *Store) GetFrontend(id int, tx *sqlx.Tx) (*Frontend, error)

func (*Store) GetShare

func (str *Store) GetShare(id int, tx *sqlx.Tx) (*Share, error)

func (*Store) IsAccountLimitJournalEmpty added in v0.4.0

func (str *Store) IsAccountLimitJournalEmpty(acctId int, trx *sqlx.Tx) (bool, error)

func (*Store) IsEnvironmentLimitJournalEmpty added in v0.4.0

func (str *Store) IsEnvironmentLimitJournalEmpty(envId int, trx *sqlx.Tx) (bool, error)

func (*Store) IsShareLimitJournalEmpty added in v0.4.0

func (str *Store) IsShareLimitJournalEmpty(shrId int, trx *sqlx.Tx) (bool, error)

func (*Store) ShareWithTokenExists added in v0.4.25

func (str *Store) ShareWithTokenExists(shrToken string, tx *sqlx.Tx) (bool, error)

func (*Store) UpdateAccount

func (str *Store) UpdateAccount(a *Account, tx *sqlx.Tx) (int, error)

func (*Store) UpdateFrontend

func (str *Store) UpdateFrontend(fe *Frontend, tx *sqlx.Tx) error

func (*Store) UpdateShare

func (str *Store) UpdateShare(shr *Share, tx *sqlx.Tx) error

Directories

Path Synopsis
sql

Jump to

Keyboard shortcuts

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