store

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	gorm.Model

	ClusterID string `gorm:"uniqueIndex"`

	TenantID string `gorm:"uniqueIndex:idx_cluster_tenant_id_name"`

	Name string `gorm:"uniqueIndex:idx_cluster_tenant_id_name"`

	RegistrationKey string
}

Cluster represents a cluster.

type ClusterSpec

type ClusterSpec struct {
	ClusterID       string
	TenantID        string
	Name            string
	RegistrationKey string
}

ClusterSpec is a spec of the cluster

type S

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

S represents the data store.

func New

func New(db *gorm.DB) *S

New creates a new store instance.

func NewTest

func NewTest(t *testing.T) (*S, func())

NewTest returns a new test store.

func (*S) AutoMigrate

func (s *S) AutoMigrate() error

AutoMigrate sets up the auto-migration task of the database.

func (*S) CreateCluster

func (s *S) CreateCluster(spec ClusterSpec) (*Cluster, error)

CreateCluster creates a cluster.

func (*S) DeleteCluster

func (s *S) DeleteCluster(clusterID, tenantID string) error

DeleteCluster deletes a cluster by cluster ID and tenant ID.

func (*S) GetCluster

func (s *S) GetCluster(clusterID, tenantID string) (*Cluster, error)

GetCluster returns a cluster by cluster ID and tenant ID.

func (*S) GetClusterByNameAndTenantID added in v0.3.0

func (s *S) GetClusterByNameAndTenantID(name, tenantID string) (*Cluster, error)

GetClusterByNameAndTenantID returns a cluster by name and tenant ID.

func (*S) ListClusters

func (s *S) ListClusters() ([]*Cluster, error)

ListClusters lists clusters.

func (*S) ListClustersByTenantID

func (s *S) ListClustersByTenantID(tenantID string) ([]*Cluster, error)

ListClustersByTenantID lists clusters.

Jump to

Keyboard shortcuts

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