datasource

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright © 2020 Marvin

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datasource

type Datasource struct {
	ID             uint64 `gorm:"primarykey;autoIncrement;comment:id" json:"id"`
	DatasourceName string `gorm:"not null;type:varchar(30);uniqueIndex:uniq_datasource_name;comment:name of datasource" json:"datasourceName"`
	DbType         string `` /* 131-byte string literal not displayed */
	Username       string `gorm:"type:varchar(100);uniqueIndex:uniq_datasource_complex;comment:username" json:"username"`
	Password       string `gorm:"type:varchar(100);comment:user password" json:"password"`
	Host           string `gorm:"type:varchar(15);uniqueIndex:uniq_datasource_complex;comment:host ip" json:"host"`
	Port           uint64 `gorm:"uniqueIndex:uniq_datasource_complex;comment:host port" json:"port"`
	ConnectParams  string `gorm:"type:varchar(150);comment:connect params" json:"connectParams"`
	ConnectCharset string `gorm:"type:varchar(60);comment:datasource connect charset" json:"connectCharset"`
	ConnectStatus  string `gorm:"type:varchar(1);comment:connection status, eg.Y/N" json:"connectStatus"`

	ServiceName   string `gorm:"type:varchar(100);comment:oracle service name" json:"serviceName"`
	PdbName       string `gorm:"type:varchar(100);comment:oracle pdb name'" json:"pdbName"`
	SessionParams string `gorm:"type:varchar(100);comment:session params" json:"sessionParams"`
	DbName        string `gorm:"type:varchar(100);comment:postgresql database name" json:"dbName"`
	*common.Entity
}

type IDatasource

type IDatasource interface {
	CreateDatasource(ctx context.Context, datasource []*Datasource) ([]*Datasource, error)
	UpdateDatasource(ctx context.Context, datasource *Datasource) (*Datasource, error)
	ListDatasource(ctx context.Context, page uint64, pageSize uint64) ([]*Datasource, error)
	GetDatasource(ctx context.Context, datasourceName string) (*Datasource, error)
	DeleteDatasource(ctx context.Context, datasourceNames []string) error
}

type RWDatasource

type RWDatasource struct {
	common.GormDB
}

func NewDatasourceRW

func NewDatasourceRW(db *gorm.DB) *RWDatasource

func (*RWDatasource) CreateDatasource

func (rw *RWDatasource) CreateDatasource(ctx context.Context, dataSource []*Datasource) ([]*Datasource, error)

func (*RWDatasource) DeleteDatasource

func (rw *RWDatasource) DeleteDatasource(ctx context.Context, datasourceNames []string) error

func (*RWDatasource) GetDatasource

func (rw *RWDatasource) GetDatasource(ctx context.Context, datasourceName string) (*Datasource, error)

func (*RWDatasource) ListDatasource

func (rw *RWDatasource) ListDatasource(ctx context.Context, page uint64, pageSize uint64) ([]*Datasource, error)

func (*RWDatasource) TableName

func (rw *RWDatasource) TableName(ctx context.Context) string

func (*RWDatasource) UpdateDatasource

func (rw *RWDatasource) UpdateDatasource(ctx context.Context, datasource *Datasource) (*Datasource, error)

Jump to

Keyboard shortcuts

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