structful

package module
v0.0.0-...-80b9529 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: GPL-3.0, LGPL-3.0-or-later Imports: 13 Imported by: 0

README

This project is licensed under the GNU Lesser General Public License v3.0. You may use this library in proprietary applications, provided that modifications to the library itself remain open source.

Documentation

Index

Constants

View Source
const (
	AdaptorType_Mongo = iota
)

Variables

This section is empty.

Functions

func Init

func Init(props *InitProps)

func SeedStructful

func SeedStructful(files []string) error

Types

type AdaptorType

type AdaptorType int

type IAdaptor

type IAdaptor interface {
	Save(data map[string]any) error

	GetWithFilter(filter map[string]any) ([]map[string]any, error)

	// GetSysDb returns the name of the database to use.
	GetDb() string

	// GetName the collection to store structful data.
	GetName() string

	CheckHash(string) bool

	List() ([]map[string]any, error)
}

type IStructful

type IStructful interface {
	Within(version string) *Structful

	Save(data map[string]any) error

	GetByGroup(group string) []map[string]any

	FilterByGroup(group string, filter map[string]any) []map[string]any

	GetOne(group, name string) map[string]any

	CheckHash(string) bool

	List() ([]map[string]any, error)
}

type InitProps

type InitProps struct {
	MongoSysDb               string
	Version                  string
	MongoStructfulCollection string
}

type MongoAdaptor

type MongoAdaptor struct {
	IAdaptor
	// contains filtered or unexported fields
}

func CreateMongoAdaptor

func CreateMongoAdaptor(sysDb string, name string) *MongoAdaptor

func (*MongoAdaptor) CheckHash

func (a *MongoAdaptor) CheckHash(hash string) bool

func (*MongoAdaptor) GetDb

func (a *MongoAdaptor) GetDb() string

func (*MongoAdaptor) GetName

func (a *MongoAdaptor) GetName() string

func (*MongoAdaptor) GetWithFilter

func (a *MongoAdaptor) GetWithFilter(filter map[string]any) ([]map[string]any, error)

func (*MongoAdaptor) List

func (a *MongoAdaptor) List() ([]map[string]any, error)

func (*MongoAdaptor) Save

func (a *MongoAdaptor) Save(data map[string]any) error

type Structful

type Structful struct {
	IStructful

	SysDb string

	Name string

	Version string

	Adaptor IAdaptor
}

func CreateStructful

func CreateStructful(props *StructfulProps) *Structful

func Current

func Current() *Structful

func GetStructful

func GetStructful(props *StructfulProps) *Structful

func (*Structful) CheckHash

func (s *Structful) CheckHash(hash string) bool

func (*Structful) FilterByGroup

func (s *Structful) FilterByGroup(group string, filter map[string]any) ([]map[string]any, error)

func (*Structful) GetByGroup

func (s *Structful) GetByGroup(group string) ([]map[string]any, error)

func (*Structful) GetOne

func (s *Structful) GetOne(group, name string) (map[string]any, error)

func (*Structful) List

func (s *Structful) List() ([]map[string]any, error)

func (*Structful) Save

func (s *Structful) Save(data map[string]any) error

type StructfulProps

type StructfulProps struct {
	Adaptor AdaptorType
	SysDb   string
	Name    string
	Version string
}

Jump to

Keyboard shortcuts

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