databases

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: BSD-3-Clause Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Description

func Description(value string) basic.Op

func Encryption

func Encryption(key string) basic.Op

func Id

func Id(value string) basic.Op

func Local

func Local(value bool) basic.Op

func Match

func Match(value string) basic.Op

func Regex

func Regex(value bool) basic.Op

func Size added in v1.2.0

func Size(value string) basic.Op

func SmartOps

func SmartOps(value []string) basic.Op

func Storage

func Storage(size string) basic.Op

func Tags

func Tags(value []string) basic.Op

func UseRegex deprecated added in v1.2.0

func UseRegex(value bool) basic.Op

Deprecated: use Regex.

Types

type Database

type Database interface {
	Get() Getter
	common.Resource[*structureSpec.Database]
}
Example
package main

import (
	"fmt"

	"github.com/spf13/afero"
	"github.com/taubyte/tau/pkg/schema/databases"
	"github.com/taubyte/tau/pkg/schema/project"
)

func main() {
	// Create a new file system in memory
	fs := afero.NewMemMapFs()

	// Open a new project with a virtual file system
	project, err := project.Open(project.VirtualFS(fs, "/"))
	if err != nil {
		return
	}

	// Create or open an database
	db, err := project.Database("test_db", "")
	if err != nil {
		return
	}

	// Set and write database fields
	err = db.Set(true,
		databases.Id("QmaEBKzOyrYL1D6gtqD86Nyr2hvXAxWHcMCu9ffxLaByMc"),
		databases.Description("a database for users"),
		databases.Tags([]string{"tag1", "tag2"}),
		databases.Match("/users"),
		databases.Regex(true),
		databases.Local(false),
		databases.Storage("50Kb"),
	)
	if err != nil {
		return
	}

	// Display the Description
	fmt.Println(db.Get().Description())

	// Open the config.yaml of the database
	config, err := afero.ReadFile(fs, "/databases/test_db.yaml")
	if err != nil {
		return
	}

	// Print config.yaml
	fmt.Println(string(config))

}
Output:
a database for users
id: QmaEBKzOyrYL1D6gtqD86Nyr2hvXAxWHcMCu9ffxLaByMc
description: a database for users
tags:
    - tag1
    - tag2
match: /users
regex: true
access:
    network: all
storage:
    size: 50Kb

func Open

func Open(seer *seer.Seer, name, application string) (Database, error)

type Getter

type Getter interface {
	basic.ResourceGetter[*structureSpec.Database]
	Match() string
	Regex() bool
	Local() bool
	Secret() bool
	Size() string
	Encryption() (key string, keyType string)
}

func Yaml

func Yaml(name, application string, yamlData []byte) (Getter, error)

Jump to

Keyboard shortcuts

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