nosql

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IdOf

func IdOf(resource string, id uuid.UUID) string

func Module

func Module() app.Module

Types

type Client

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

func NewClient

func NewClient(cfg *SurrealDBConfig) (*Client, error)

func (*Client) Create

func (c *Client) Create(ctx context.Context, id string, data any) (any, error)

func (*Client) OnStart

func (c *Client) OnStart(context.Context) error

func (*Client) OnStop

func (c *Client) OnStop(context.Context) error

type Entity

type Entity[T any] struct {
	Id    string `json:"id"`
	Value *T     `json:"value"`
	// contains filtered or unexported fields
}

func EntityById

func EntityById[T any](resource string, id uuid.UUID, value T) Entity[T]

func (*Entity[T]) Load

func (e *Entity[T]) Load(client *Client) error

func (*Entity[T]) Save

func (e *Entity[T]) Save(client *Client) error

type IEntity

type IEntity[T any] interface {
	AsEntity() Entity[T]
}

type SurrealDBConfig

type SurrealDBConfig struct {
	Username  string
	Password  string
	Host      string
	Port      uint16
	Secure    bool
	Namespace string
	Database  string
}

func ConfigFromUrl

func ConfigFromUrl(uri url.URL) (*SurrealDBConfig, error)

func (SurrealDBConfig) ConnectionURI

func (s SurrealDBConfig) ConnectionURI() string

Jump to

Keyboard shortcuts

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