metabase

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsContainerExist

func IsContainerExist(name string) bool

func RemoveContainer

func RemoveContainer(name string) error

func RemoveDatabase

func RemoveDatabase(dataDir string) error

func RemoveImageContainer

func RemoveImageContainer(image string) error

func StartContainer

func StartContainer(name string) error

func StopContainer

func StopContainer(name string) error

func TestAvailability added in v1.1.0

func TestAvailability() error

Types

type Config

type Config struct {
	Database      *csconfig.DatabaseCfg `yaml:"database"`
	ListenAddr    string                `yaml:"listen_addr"`
	ListenPort    string                `yaml:"listen_port"`
	ListenURL     string                `yaml:"listen_url"`
	Username      string                `yaml:"username"`
	Password      string                `yaml:"password"`
	DBPath        string                `yaml:"metabase_db_path"`
	DockerGroupID string                `yaml:"-"`
	Image         string                `yaml:"image"`
}

type Container

type Container struct {
	ListenAddr    string
	ListenPort    string
	SharedFolder  string
	Image         string
	Name          string
	ID            string
	CLI           *client.Client
	MBDBUri       string
	DockerGroupID string
}

func NewContainer

func NewContainer(listenAddr string, listenPort string, sharedFolder string, containerName string, image string, mbDBURI string, dockerGroupID string) (*Container, error)

func (*Container) Create

func (c *Container) Create() error

func (*Container) Start

func (c *Container) Start() error

type Database

type Database struct {
	DBUrl   string
	Model   *Model
	Config  *csconfig.DatabaseCfg
	Client  *MBClient
	Details *Details
}

func NewDatabase

func NewDatabase(config *csconfig.DatabaseCfg, client *MBClient, remoteDBAddr string) (*Database, error)

func (*Database) Update

func (d *Database) Update() error

type Details

type Details struct {
	Db                string      `json:"db"`
	Host              string      `json:"host"`
	Port              int         `json:"port"`
	Dbname            string      `json:"dbname"`
	User              string      `json:"user"`
	Password          string      `json:"password"`
	Ssl               bool        `json:"ssl"`
	AdditionalOptions interface{} `json:"additional-options"`
	TunnelEnabled     bool        `json:"tunnel-enabled"`
}

type MBClient added in v1.5.3

type MBClient struct {
	CTX    *sling.Sling
	Client *http.Client
}

func NewMBClient added in v1.5.3

func NewMBClient(url string) (*MBClient, error)

func (*MBClient) Do added in v1.5.3

func (h *MBClient) Do(method string, route string, body interface{}) (interface{}, interface{}, error)

func (*MBClient) Set added in v1.5.3

func (h *MBClient) Set(key string, value string)

Set headers as key:value

type Metabase

type Metabase struct {
	Config        *Config
	Client        *MBClient
	Container     *Container
	Database      *Database
	InternalDBURL string
}

func NewMetabase

func NewMetabase(configPath string, containerName string) (*Metabase, error)

func SetupMetabase

func SetupMetabase(dbConfig *csconfig.DatabaseCfg, listenAddr string, listenPort string, username string, password string, mbDBPath string, dockerGroupID string, containerName string, image string) (*Metabase, error)

func (*Metabase) DownloadDatabase

func (m *Metabase) DownloadDatabase(force bool) error

func (*Metabase) DumpConfig

func (m *Metabase) DumpConfig(path string) error

func (*Metabase) ExtractDatabase

func (m *Metabase) ExtractDatabase(buf *bytes.Reader) error

func (*Metabase) Init

func (m *Metabase) Init(containerName string, image string) error

func (*Metabase) LoadConfig

func (m *Metabase) LoadConfig(configPath string) error

func (*Metabase) Login

func (m *Metabase) Login(username string, password string) error

func (*Metabase) ResetCredentials

func (m *Metabase) ResetCredentials() error

func (*Metabase) ResetPassword

func (m *Metabase) ResetPassword(current string, newPassword string) error

func (*Metabase) ResetUsername

func (m *Metabase) ResetUsername(username string) error

func (*Metabase) Scan

func (m *Metabase) Scan() error

func (*Metabase) WaitAlive

func (m *Metabase) WaitAlive() error

type Model

type Model struct {
	Engine         string                 `json:"engine"`
	Name           string                 `json:"name"`
	Details        *Details               `json:"details"`
	AutoRunQueries bool                   `json:"auto_run_queries"`
	IsFullSync     bool                   `json:"is_full_sync"`
	IsOnDemand     bool                   `json:"is_on_demand"`
	Schedules      map[string]interface{} `json:"schedules"`
}

Jump to

Keyboard shortcuts

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