directory

package
v0.0.0-...-a87dae0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlobalDirKey   = NamespaceID("global")
	NonSaaSDirKey  = NamespaceID("default")
	DatabaseDirKey = NamespaceID("database")
	NamespaceKey   = "namespace"
)
View Source
const (
	ConsoleURLSettingKey = "console_url"
)

Variables

View Source
var (
	MinioBucket         = utils.GetEnvOrDefault("TOAE_MINIO_BUCKET", string(NonSaaSDirKey))
	MinioDatabaseBucket = utils.GetEnvOrDefault("TOAE_MINIO_DB_BUCKET", string(DatabaseDirKey))
)
View Source
var ErrDatabaseConfigNotFound = errors.New("database config not found")
View Source
var ErrExhaustedResources = errors.New("Exhausted worker resources")
View Source
var ErrNamespaceNotFound = errors.New("namespace/tenet-id not found")

Functions

func ForEachNamespace

func ForEachNamespace(applyFn func(ctx context.Context) (string, error))

func GetManagementConsoleURL

func GetManagementConsoleURL(ctx context.Context) (string, error)

func GetManagementHost

func GetManagementHost(ctx context.Context) (string, error)

func Injector

func Injector(next http.Handler) http.Handler

Injector makes sure the context is filled with the information provided by the JWT.

func IsNonSaaSDeployment

func IsNonSaaSDeployment() bool

func Neo4jClient

func Neo4jClient(ctx context.Context) (neo4j.Driver, error)

func NewContextWithNameSpace

func NewContextWithNameSpace(ns NamespaceID) context.Context

func NewGlobalContext

func NewGlobalContext() context.Context

func NewSqlConnection

func NewSqlConnection(ctx context.Context) (*sql.DB, error)

func PostgresClient

func PostgresClient(ctx context.Context) (*postgresqlDb.Queries, error)

func RedisClient

func RedisClient(ctx context.Context) (*redis.Client, error)

func WithDatabaseContext

func WithDatabaseContext(ctx context.Context) context.Context

func WithGlobalContext

func WithGlobalContext(ctx context.Context) context.Context

Types

type AlreadyPresentError

type AlreadyPresentError struct {
	Path string
}

func (AlreadyPresentError) Error

func (e AlreadyPresentError) Error() string

type CypherDriver

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

func (CypherDriver) Close

func (cd CypherDriver) Close() error

func (CypherDriver) NewSession

func (cd CypherDriver) NewSession(config neo4j.SessionConfig) neo4j.Session

func (CypherDriver) Session

func (cd CypherDriver) Session(accessMode neo4j.AccessMode, bookmarks ...string) (neo4j.Session, error)

func (CypherDriver) Target

func (cd CypherDriver) Target() url.URL

func (CypherDriver) VerifyConnectivity

func (cd CypherDriver) VerifyConnectivity() error

type CypherSession

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

func (CypherSession) BeginTransaction

func (cs CypherSession) BeginTransaction(configurers ...func(*neo4j.TransactionConfig)) (neo4j.Transaction, error)

func (CypherSession) Close

func (cs CypherSession) Close() error

func (CypherSession) LastBookmark

func (cs CypherSession) LastBookmark() string

func (CypherSession) ReadTransaction

func (cs CypherSession) ReadTransaction(work neo4j.TransactionWork, configurers ...func(*neo4j.TransactionConfig)) (interface{}, error)

func (CypherSession) Run

func (cs CypherSession) Run(cypher string, params map[string]interface{}, configurers ...func(*neo4j.TransactionConfig)) (neo4j.Result, error)

func (CypherSession) WriteTransaction

func (cs CypherSession) WriteTransaction(work neo4j.TransactionWork, configurers ...func(*neo4j.TransactionConfig)) (interface{}, error)

type CypherTransaction

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

func (CypherTransaction) Close

func (ct CypherTransaction) Close() error

func (CypherTransaction) Commit

func (ct CypherTransaction) Commit() error

func (CypherTransaction) Rollback

func (ct CypherTransaction) Rollback() error

func (CypherTransaction) Run

func (ct CypherTransaction) Run(cypher string, params map[string]interface{}) (neo4j.Result, error)

type DBConfigs

type DBConfigs struct {
	Redis    *RedisConfig
	Neo4j    *Neo4jConfig
	Postgres *PostgresqlConfig
	Minio    *MinioConfig
}

func GetDatabaseConfig

func GetDatabaseConfig(ctx context.Context) (*DBConfigs, error)

type FileDeleteError

type FileDeleteError struct {
	Path string
}

func (FileDeleteError) Error

func (e FileDeleteError) Error() string

type FileManager

type FileManager interface {
	ListFiles(ctx context.Context, pathPrefix string, recursive bool, maxKeys int, skipDir bool) []ObjectInfo
	UploadLocalFile(ctx context.Context, filename string, localFilename string, overwrite bool, extra interface{}) (UploadResult, error)
	UploadFile(ctx context.Context, filename string, data []byte, overwrite bool, extra interface{}) (UploadResult, error)
	DeleteFile(ctx context.Context, filename string, addFilePathPrefix bool, extra interface{}) error
	DownloadFile(ctx context.Context, remoteFile string, localFile string, extra interface{}) error
	DownloadFileTo(ctx context.Context, remoteFile string, localFile io.WriteCloser, extra interface{}) error
	DownloadFileContexts(ctx context.Context, remoteFile string, extra interface{}) ([]byte, error)
	ExposeFile(ctx context.Context, filePath string, addFilePathPrefix bool, expires time.Duration, reqParams url.Values) (string, error)
	CreatePublicUploadURL(ctx context.Context, filePath string, addFilePathPrefix bool, expires time.Duration, reqParams url.Values) (string, error)
	Client() interface{}
	Bucket() string
	CreatePublicBucket(ctx context.Context, bucket string) error
	CleanNamespace(ctx context.Context) error
}

func MinioClient

func MinioClient(ctx context.Context) (FileManager, error)

type MinioConfig

type MinioConfig struct {
	Endpoint   string
	Username   string
	Password   string
	BucketName string
	Secure     bool
	Region     string
}

type MinioFileManager

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

func (*MinioFileManager) Bucket

func (mfm *MinioFileManager) Bucket() string

func (*MinioFileManager) CleanNamespace

func (mfm *MinioFileManager) CleanNamespace(ctx context.Context) error

func (*MinioFileManager) Client

func (mfm *MinioFileManager) Client() interface{}

func (*MinioFileManager) CreatePublicBucket

func (mfm *MinioFileManager) CreatePublicBucket(ctx context.Context, bucket string) error

func (*MinioFileManager) CreatePublicUploadURL

func (mfm *MinioFileManager) CreatePublicUploadURL(ctx context.Context, filePath string, addFilePathPrefix bool, expires time.Duration, reqParams url.Values) (string, error)

func (*MinioFileManager) DeleteFile

func (mfm *MinioFileManager) DeleteFile(ctx context.Context, filePath string, addFilePathPrefix bool, extra interface{}) error

func (*MinioFileManager) DownloadFile

func (mfm *MinioFileManager) DownloadFile(ctx context.Context, remoteFile string, localFile string, extra interface{}) error

func (*MinioFileManager) DownloadFileContexts

func (mfm *MinioFileManager) DownloadFileContexts(ctx context.Context, remoteFile string, extra interface{}) ([]byte, error)

func (*MinioFileManager) DownloadFileTo

func (mfm *MinioFileManager) DownloadFileTo(ctx context.Context, remoteFile string, writer io.WriteCloser, extra interface{}) error

func (*MinioFileManager) ExposeFile

func (mfm *MinioFileManager) ExposeFile(ctx context.Context, filePath string, addFilePathPrefix bool, expires time.Duration, reqParams url.Values) (string, error)

func (*MinioFileManager) ListFiles

func (mfm *MinioFileManager) ListFiles(ctx context.Context, pathPrefix string, recursive bool, maxKeys int, skipDir bool) []ObjectInfo

func (*MinioFileManager) UploadFile

func (mfm *MinioFileManager) UploadFile(ctx context.Context,
	filename string, data []byte, overwrite bool, extra interface{}) (UploadResult, error)

func (*MinioFileManager) UploadLocalFile

func (mfm *MinioFileManager) UploadLocalFile(ctx context.Context,
	filename string, localFilename string, overwrite bool, extra interface{}) (UploadResult, error)

type NamespaceID

type NamespaceID string

func ExtractNamespace

func ExtractNamespace(ctx context.Context) (NamespaceID, error)

func FetchNamespace

func FetchNamespace(email string) NamespaceID

func GetAllNamespaces

func GetAllNamespaces() []NamespaceID

type Neo4jConfig

type Neo4jConfig struct {
	Endpoint string
	Username string
	Password string
}

type ObjectInfo

type ObjectInfo struct {
	Key          string    `json:"name"`         // Name of the object
	LastModified time.Time `json:"lastModified"` // Date and time the object was last modified.
	Size         int64     `json:"size"`         // Size in bytes of the object.
	ContentType  string    `json:"contentType"`  // A standard MIME type describing the format of the object data.
	Expires      time.Time `json:"expires"`      // The date and time at which the object is no longer able to be cached.
	IsDir        bool      `json:"isDir"`        // Is this object a directory
}

type PathDoesNotExistsError

type PathDoesNotExistsError struct {
	Path string
}

func (PathDoesNotExistsError) Error

func (e PathDoesNotExistsError) Error() string

type PostgresqlConfig

type PostgresqlConfig struct {
	Host     string
	Port     int
	Username string
	Password string
	Database string
	SslMode  string
}

type RedisConfig

type RedisConfig struct {
	Endpoint string
	Password string
	Database int
}

type SettingValue

type SettingValue struct {
	Label       string      `json:"label"`
	Value       interface{} `json:"value"`
	Description string      `json:"description"`
}

type UploadResult

type UploadResult struct {
	Bucket       string
	Key          string
	ETag         string
	Size         int64
	LastModified time.Time
	Location     string
	VersionID    string
}

type WorkEnqueuer

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

func Worker

func Worker(ctx context.Context) (WorkEnqueuer, error)

func (WorkEnqueuer) Enqueue

func (ws WorkEnqueuer) Enqueue(task_enum string, data []byte, opts ...asynq.Option) error

Jump to

Keyboard shortcuts

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