sqlite

package
v0.0.0-...-c11ca93 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name string = "SqliteDb"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowedUserShare

type AllowedUserShare struct {
	User    string  `sql:"type:varchar;"`
	ShareId string  `sql:"type:varchar;"`
	Key     *string `sql:"type:varchar;"` // Can be empty only for a creation or on a Get
}

type LogLevel

type LogLevel int
const (
	DEBUG LogLevel = iota
	INFO
	WARNING
	ERROR
)

type Share

type Share struct {
	User string  `sql:"type:varchar;"` //This will only be set by server. This is the user that issued the share link
	Name *string `sql:"type:varchar;"` // Name used for displaying the share link if multiple share links available
	Path *string `sql:"type:varchar;"` // Can be empty only if ShareLinkKey is provided
	Key  *string `sql:"type:varchar;"` // Can be empty only for a creation or on a Get
	// UserList *[]string             `sql:"type:varchar;"` // This is only available for EnumRestricted mode
	Type        api.EnumShareLinkType `sql:"type:integer;"`
	Access      api.AccessType        `sql:"type:integer;"` // What access would people coming with this link have
	Id          string                `sql:"type:varchar;"`
	Password    *string               `sql:"type:varchar;"`
	NbDownloads *int                  `sql:"type:integer;"` // Number of downloads for a file. This is only valid for file shared, not directories
}

type SqliteDatabase

type SqliteDatabase struct {
	Database string `json:"database"`
	// contains filtered or unexported fields
}

func NewSqliteDatase

func NewSqliteDatase(config *json.RawMessage, debug bool) (d *SqliteDatabase, err error)

func (*SqliteDatabase) AddAccount

func (d *SqliteDatabase) AddAccount(account *types.Account) (err error)
func (d *SqliteDatabase) AddDownloadLink(link *types.DownloadLink) (err error)

func (*SqliteDatabase) ClearAccesses

func (d *SqliteDatabase) ClearAccesses() error

func (*SqliteDatabase) DeleteCommand

func (d *SqliteDatabase) DeleteCommand(ref *string) error

func (*SqliteDatabase) GetAccess

func (d *SqliteDatabase) GetAccess(user *string, path string) (api.AccessType, error)

func (*SqliteDatabase) GetAccount

func (d *SqliteDatabase) GetAccount(authType string, ref string) (account *types.Account, id string, err error)

func (*SqliteDatabase) GetCommand

func (d *SqliteDatabase) GetCommand(ref string) (command *types.Command, err error)
func (d *SqliteDatabase) GetDownloadLink(ref string) (link *types.DownloadLink, err error)

func (*SqliteDatabase) GetSession

func (d *SqliteDatabase) GetSession(ref string) (session *types.Session, err error)
func (d *SqliteDatabase) GetShareLink(key string) (shareLink *types.ShareLink, err error)

func (*SqliteDatabase) GetShareLinksFromPath

func (d *SqliteDatabase) GetShareLinksFromPath(path string, user string) (shareLink []*types.ShareLink, err error)

func (*SqliteDatabase) GetUserAccount

func (d *SqliteDatabase) GetUserAccount(id string) (account *types.Account, err error)

func (*SqliteDatabase) ListAccounts

func (d *SqliteDatabase) ListAccounts(searchDict map[string]string) (accounts []*types.Account, err error)

func (*SqliteDatabase) ListCommands

func (d *SqliteDatabase) ListCommands(user *string, offset int, limit int, search_parameters *api.CommandsSearchParameters) ([]*types.Command, int, error)
func (d *SqliteDatabase) ListShareLinks(user string) (shareLinks []*types.ShareLink, err error)

func (*SqliteDatabase) Log

func (d *SqliteDatabase) Log(level LogLevel, message string)

func (*SqliteDatabase) Name

func (d *SqliteDatabase) Name() string

func (*SqliteDatabase) RemoveSession

func (d *SqliteDatabase) RemoveSession(ref string) (err error)
func (d *SqliteDatabase) RemoveShareLink(key string) (err error)

func (*SqliteDatabase) SaveCommand

func (d *SqliteDatabase) SaveCommand(command *types.Command) (err error)
func (d *SqliteDatabase) SaveShareLink(shareLink *types.ShareLink) (err error)

func (*SqliteDatabase) SetAccess

func (d *SqliteDatabase) SetAccess(user *string, path string, access api.AccessType) error

func (*SqliteDatabase) StoreSession

func (d *SqliteDatabase) StoreSession(session *types.Session) (err error)

func (*SqliteDatabase) UpdateAccount

func (d *SqliteDatabase) UpdateAccount(id string, account *types.Account) (err error)
func (d *SqliteDatabase) UpdateShareLink(shareLink *types.ShareLink) (err error)

type User

type User struct {
	Login   string `sql:"type:varchar;"`
	Email   string `sql:"type:varchar;"`
	Id      string `sql:"type:varchar;"` //This id should be unique depending on the DbType
	IsAdmin bool   `sql:"type:boolean;"` //Can only be changed by the admin
}

type UserSpecificAuth

type UserSpecificAuth struct {
	AuthType string `sql:"type:varchar;"`
	Blob     string `sql:"type:varchar;"`
	UserId   string `sql:"type:varchar;"`
}

Jump to

Keyboard shortcuts

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