nod

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: MIT Imports: 3 Imported by: 0

README

nod

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	Id          string         `gorm:"type:char(36);primaryKey"`
	NamespaceId *string        `gorm:"type:char(36);index:idx_namespace_id,priority:1;index"`
	ParentId    *string        `gorm:"type:char(36);index:idx_parent_id,priority:2;index"`
	Type        string         `gorm:"type:text;not null;index;default:''"`
	Kind        string         `gorm:"type:text;not null;index;default:''"`
	Status      string         `gorm:"type:text;not null;index;default:''"`
	Name        string         `gorm:"type:text;not null;index"`
	Metadata    datatypes.JSON `gorm:"type:json;not null;default:'{}'"`
	CreatedAt   time.Time      `gorm:"type:datetime;not null;autoCreateTime"`
	UpdatedAt   time.Time      `gorm:"type:datetime;not null;autoUpdateTime"`
}

type NodeRepository

type NodeRepository struct {
	DB *gorm.DB
}

func (*NodeRepository) Create

func (r *NodeRepository) Create(node *Node) error

func (*NodeRepository) Delete

func (r *NodeRepository) Delete(nodeId string) error

func (*NodeRepository) Save

func (r *NodeRepository) Save(node *Node) error

func (*NodeRepository) SubTree

func (r *NodeRepository) SubTree(namespaceId, parentId string) ([]Node, error)

type NodeTag

type NodeTag struct {
	NodeId string `gorm:"type:char(36);primaryKey;index:idx_node_tag,priority:1"`
	TagId  string `gorm:"type:char(36);primaryKey;index:idx_node_tag,priority:2"`
}

type Repository

type Repository struct {
	Node *NodeRepository
	// contains filtered or unexported fields
}

func (*Repository) Save

func (r *Repository) Save(node *Node, tags []Tag) error

func (*Repository) Transaction

func (r *Repository) Transaction(fc func(txRepo *Repository) error) error

type Tag

type Tag struct {
	Id          string    `gorm:"type:char(36);primaryKey"`
	NamespaceId *string   `gorm:"type:char(36);index:idx_namespace_id,priority:1;index"`
	Name        string    `gorm:"type:text;not null;index"`
	CreatedAt   time.Time `gorm:"type:datetime;not null;autoCreateTime"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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