resource

package
v1.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	REST_RESOURCE          = "restapi"
	MYSQL_RESOURCE         = "mysql"
	MARIADB_RESOURCE       = "mariadb"
	TIDB_RESOURCE          = "tidb"
	POSTGRES_RESOURCE      = "postgresql"
	REDIS_RESOURCE         = "redis"
	MONGODB_RESOURCE       = "mongodb"
	ELASTICSEARCH_RESOURCE = "elasticsearch"
	S3_RESOURCE            = "s3"
	SMTP_RESOURCE          = "smtp"
	SUPABASEDB_RESOURCE    = "supabasedb"
	FIREBASE_RESOURCE      = "firebase"
	CLICKHOUSE_RESOURCE    = "clickhouse"
	GRAPHQL_RESOURCE       = "graphql"
	MSSQL_RESOURCE         = "mssql"
	HUGGINGFACE_RESOURCE   = "huggingface"
	DYNAMODB_RESOURCE      = "dynamodb"
	SNOWFLAKE_RESOURCE     = "snowflake"
	COUCHDB_RESOURCE       = "couchdb"
	HFENDPOINT_RESOURCE    = "hfendpoint"
	ORACLE_RESOURCE        = "oracle"
)

Functions

This section is empty.

Types

type AbstractResourceFactory

type AbstractResourceFactory interface {
	Build() common.DataConnector
}

type Factory

type Factory struct {
	Type string
}

func (*Factory) Generate

func (f *Factory) Generate() common.DataConnector

type ResourceDto

type ResourceDto struct {
	ID        int                    `json:"resourceId"`
	UID       uuid.UUID              `json:"uid"`
	TeamID    int                    `json:"teamID"`
	Name      string                 `json:"resourceName" validate:"required"`
	Type      string                 `` /* 212-byte string literal not displayed */
	Options   map[string]interface{} `json:"content" validate:"required"`
	CreatedAt time.Time              `json:"createdAt,omitempty"`
	CreatedBy int                    `json:"createdBy,omitempty"`
	UpdatedAt time.Time              `json:"updatedAt,omitempty"`
	UpdatedBy int                    `json:"updatedBy,omitempty"`
}

func (*ResourceDto) ConstructByMap

func (resourced *ResourceDto) ConstructByMap(data interface{})

func (*ResourceDto) InitUID added in v1.9.0

func (r *ResourceDto) InitUID()

func (*ResourceDto) SetTeamID added in v1.9.0

func (r *ResourceDto) SetTeamID(teamID int)

type ResourceDtoForExport added in v1.9.0

type ResourceDtoForExport struct {
	ID        string                 `json:"resourceId"`
	UID       uuid.UUID              `json:"uid"`
	TeamID    string                 `json:"teamID"`
	Name      string                 `json:"resourceName" validate:"required"`
	Type      string                 `` /* 194-byte string literal not displayed */
	Options   map[string]interface{} `json:"content" validate:"required"`
	CreatedAt time.Time              `json:"createdAt,omitempty"`
	CreatedBy string                 `json:"createdBy,omitempty"`
	UpdatedAt time.Time              `json:"updatedAt,omitempty"`
	UpdatedBy string                 `json:"updatedBy,omitempty"`
}

func NewResourceDtoForExport added in v1.9.0

func NewResourceDtoForExport(r *ResourceDto) *ResourceDtoForExport

func (*ResourceDtoForExport) ExportForFeedback added in v1.9.0

func (resp *ResourceDtoForExport) ExportForFeedback() interface{}

func (*ResourceDtoForExport) ExportResourceDto added in v1.9.0

func (resp *ResourceDtoForExport) ExportResourceDto() ResourceDto

type ResourceService

type ResourceService interface {
	CreateResource(resource ResourceDto) (*ResourceDtoForExport, error)
	DeleteResource(teamID int, id int) error
	UpdateResource(resource ResourceDto) (*ResourceDtoForExport, error)
	GetResource(teamID int, id int) (*ResourceDtoForExport, error)
	FindAllResources(teamID int) ([]*ResourceDtoForExport, error)
	TestConnection(resource ResourceDto) (bool, error)
	ValidateResourceOptions(resourceType string, options map[string]interface{}) error
	GetMetaInfo(teamID int, id int) (map[string]interface{}, error)
}

type ResourceServiceImpl

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

func NewResourceServiceImpl

func NewResourceServiceImpl(logger *zap.SugaredLogger, resourceRepository repository.ResourceRepository) *ResourceServiceImpl

func (*ResourceServiceImpl) CreateResource

func (impl *ResourceServiceImpl) CreateResource(resource ResourceDto) (*ResourceDtoForExport, error)

func (*ResourceServiceImpl) DeleteResource

func (impl *ResourceServiceImpl) DeleteResource(teamID, id int) error

func (*ResourceServiceImpl) FindAllResources

func (impl *ResourceServiceImpl) FindAllResources(teamID int) ([]*ResourceDtoForExport, error)

func (*ResourceServiceImpl) GetMetaInfo

func (impl *ResourceServiceImpl) GetMetaInfo(teamID int, id int) (map[string]interface{}, error)

func (*ResourceServiceImpl) GetResource

func (impl *ResourceServiceImpl) GetResource(teamID, id int) (*ResourceDtoForExport, error)

func (*ResourceServiceImpl) TestConnection

func (impl *ResourceServiceImpl) TestConnection(resource ResourceDto) (bool, error)

func (*ResourceServiceImpl) UpdateResource

func (impl *ResourceServiceImpl) UpdateResource(resource ResourceDto) (*ResourceDtoForExport, error)

func (*ResourceServiceImpl) ValidateResourceOptions

func (impl *ResourceServiceImpl) ValidateResourceOptions(resourceType string, options map[string]interface{}) error

Jump to

Keyboard shortcuts

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