metabase

package
v1.5.30 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 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() error

func StartContainer

func StartContainer(name string) error

func StopContainer

func StopContainer(name string) error

func TestAvailability

func TestAvailability() error

Types

type APIClient

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

func NewAPIClient

func NewAPIClient(url string) (*APIClient, error)

func (*APIClient) Do

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

func (*APIClient) Set

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

Set set headers as key:value

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:"-"`
}

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  *APIClient
	Details *Details
}

func NewDatabase

func NewDatabase(config *csconfig.DatabaseCfg, client *APIClient, 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 Metabase

type Metabase struct {
	Config        *Config
	Client        *APIClient
	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) (*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) 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