store

package
v0.4.39 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const Unlimited = -1

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 AccountRequest

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

type AppliedLimitClass added in v0.4.31

type AppliedLimitClass struct {
	Model
	AccountId    int
	LimitClassId int
}

type BandwidthClass added in v0.4.31

type BandwidthClass interface {
	BaseLimitClass
	IsScoped() bool
	GetBackendMode() sdk.BackendMode
	GetPeriodMinutes() int
	GetRxBytes() int64
	GetTxBytes() int64
	GetTotalBytes() int64
	GetLimitAction() LimitAction
}

type BandwidthLimitJournalEntry added in v0.4.31

type BandwidthLimitJournalEntry struct {
	Model
	AccountId    int
	LimitClassId *int
	Action       LimitAction
	RxBytes      int64
	TxBytes      int64
}

type BaseLimitClass added in v0.4.31

type BaseLimitClass interface {
	IsGlobal() bool
	GetLimitClassId() int
	String() string
}

type Config

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

type Environment

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

type Frontend

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

type InviteToken

type InviteToken struct {
	Model
	Token   string
	Deleted bool
}

type LimitAction added in v0.4.0

type LimitAction string
const (
	LimitLimitAction   LimitAction = "limit"
	WarningLimitAction LimitAction = "warning"
)

type LimitClass added in v0.4.31

type LimitClass struct {
	Model
	Label          *string
	BackendMode    *sdk.BackendMode
	Environments   int
	Shares         int
	ReservedShares int
	UniqueNames    int
	ShareFrontends int
	PeriodMinutes  int
	RxBytes        int64
	TxBytes        int64
	TotalBytes     int64
	LimitAction    LimitAction
}

func (LimitClass) GetBackendMode added in v0.4.31

func (lc LimitClass) GetBackendMode() sdk.BackendMode

func (LimitClass) GetEnvironments added in v0.4.31

func (lc LimitClass) GetEnvironments() int

func (LimitClass) GetLimitAction added in v0.4.31

func (lc LimitClass) GetLimitAction() LimitAction

func (LimitClass) GetLimitClassId added in v0.4.31

func (lc LimitClass) GetLimitClassId() int

func (LimitClass) GetPeriodMinutes added in v0.4.31

func (lc LimitClass) GetPeriodMinutes() int

func (LimitClass) GetReservedShares added in v0.4.31

func (lc LimitClass) GetReservedShares() int

func (LimitClass) GetRxBytes added in v0.4.31

func (lc LimitClass) GetRxBytes() int64

func (LimitClass) GetShareFrontends added in v0.4.32

func (lc LimitClass) GetShareFrontends() int

func (LimitClass) GetShares added in v0.4.31

func (lc LimitClass) GetShares() int

func (LimitClass) GetTotalBytes added in v0.4.31

func (lc LimitClass) GetTotalBytes() int64

func (LimitClass) GetTxBytes added in v0.4.31

func (lc LimitClass) GetTxBytes() int64

func (LimitClass) GetUniqueNames added in v0.4.31

func (lc LimitClass) GetUniqueNames() int

func (LimitClass) IsGlobal added in v0.4.31

func (lc LimitClass) IsGlobal() bool

func (LimitClass) IsScoped added in v0.4.31

func (lc LimitClass) IsScoped() bool

func (LimitClass) String added in v0.4.31

func (lc LimitClass) String() string

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 ResourceCountClass added in v0.4.31

type ResourceCountClass interface {
	BaseLimitClass
	GetEnvironments() int
	GetShares() int
	GetReservedShares() int
	GetUniqueNames() int
	GetShareFrontends() int
}

type Share

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

type Store

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

func Open

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

func (*Store) ApplyLimitClass added in v0.4.31

func (str *Store) ApplyLimitClass(lc *AppliedLimitClass, trx *sqlx.Tx) (int, 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) CreateAccountRequest

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

func (*Store) CreateBandwidthLimitJournalEntry added in v0.4.31

func (str *Store) CreateBandwidthLimitJournalEntry(j *BandwidthLimitJournalEntry, trx *sqlx.Tx) (int, error)

func (*Store) CreateEnvironment

func (str *Store) CreateEnvironment(accountId int, i *Environment, tx *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) CreateLimitClass added in v0.4.31

func (str *Store) CreateLimitClass(lc *LimitClass, trx *sqlx.Tx) (int, 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) 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) DeleteAccountRequest

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

func (*Store) DeleteBandwidthLimitJournalEntryForGlobal added in v0.4.31

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

func (*Store) DeleteBandwidthLimitJournalEntryForLimitClass added in v0.4.31

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

func (*Store) DeleteEnvironment

func (str *Store) DeleteEnvironment(id int, tx *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) 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) FindAllBandwidthLimitJournal added in v0.4.31

func (str *Store) FindAllBandwidthLimitJournal(trx *sqlx.Tx) ([]*BandwidthLimitJournalEntry, error)

func (*Store) FindAllLatestBandwidthLimitJournal added in v0.4.31

func (str *Store) FindAllLatestBandwidthLimitJournal(trx *sqlx.Tx) ([]*BandwidthLimitJournalEntry, error)

func (*Store) FindAllLatestBandwidthLimitJournalForAccount added in v0.4.31

func (str *Store) FindAllLatestBandwidthLimitJournalForAccount(acctId int, trx *sqlx.Tx) ([]*BandwidthLimitJournalEntry, error)

func (*Store) FindAllShares added in v0.4.0

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

func (*Store) FindAppliedLimitClassesForAccount added in v0.4.31

func (str *Store) FindAppliedLimitClassesForAccount(acctId int, trx *sqlx.Tx) ([]*LimitClass, 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) FindLatestBandwidthLimitJournal added in v0.4.31

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

func (*Store) FindLatestBandwidthLimitJournalForGlobal added in v0.4.31

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

func (*Store) FindLatestBandwidthLimitJournalForLimitClass added in v0.4.31

func (str *Store) FindLatestBandwidthLimitJournalForLimitClass(acctId, lcId int, trx *sqlx.Tx) (*BandwidthLimitJournalEntry, 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) FindShareWithToken

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

func (*Store) FindShareWithTokenEvenIfDeleted added in v0.4.31

func (str *Store) FindShareWithTokenEvenIfDeleted(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) GetLimitClass added in v0.4.31

func (str *Store) GetLimitClass(lcId int, trx *sqlx.Tx) (*LimitClass, error)

func (*Store) GetShare

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

func (*Store) IsAccountGrantedSkipInterstitial added in v0.4.36

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

func (*Store) IsBandwidthLimitJournalEmpty added in v0.4.31

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

func (*Store) IsBandwidthLimitJournalEmptyForGlobal added in v0.4.31

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

func (*Store) IsBandwidthLimitJournalEmptyForLimitClass added in v0.4.31

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

func (*Store) IsFrontendGrantedToAccount added in v0.4.32

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

func (*Store) LimitCheckLock added in v0.4.31

func (str *Store) LimitCheckLock(acctId int, trx *sqlx.Tx) 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