indexstore

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: AGPL-3.0 Imports: 6 Imported by: 0 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.

README

Index Store Open in Gitpod

tests Go Report Card PkgGoDev

Package for creating indexes to optimize query performance and scalability

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). You can find a copy of the license at https://www.gnu.org/licenses/agpl-3.0.en.html

For commercial use, please use my contact page to obtain a commercial license.

Introduction

In database design, creating separate tables specifically for indexing and searching purposes is a technique often employed to optimize query performance and scalability. This approach, while requiring additional database overhead, can significantly improve the speed and efficiency of complex search operations.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NewStoreOptions

type NewStoreOptions struct {
	TableName          string
	DB                 *sql.DB
	DbDriverName       string
	AutomigrateEnabled bool
	DebugEnabled       bool
	Columns            []sb.Column
}

NewStoreOptions define the options for creating a new session store

type SearchQuery

type SearchQuery struct {
	Where     goqu.Expression
	Offset    int
	Limit     int
	SortOrder string
	OrderBy   string
}

type Store

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

Store is the index store

func NewStore

func NewStore(opts NewStoreOptions) (*Store, error)

NewStore creates a new entity store

func (*Store) AutoMigrate

func (st *Store) AutoMigrate() error

AutoMigrate auto migrate

It will drop the index table and create it again

func (*Store) Count

func (store *Store) Count(query SearchQuery) (int64, error)

func (*Store) Drop

func (store *Store) Drop() error

func (*Store) EnableDebug

func (st *Store) EnableDebug(debug bool)

EnableDebug - enables the debug option

func (*Store) Insert

func (store *Store) Insert(data map[string]any) error

func (*Store) InsertMany

func (store *Store) InsertMany(data []map[string]any) error

func (*Store) Search

func (store *Store) Search(query SearchQuery) ([]map[string]any, error)

func (*Store) Truncate

func (store *Store) Truncate() error

type StoreInterface

type StoreInterface interface {
	Insert(data map[string]any) error
	Search(query SearchQuery) ([]map[string]any, error)
	Drop() error
	Truncate() error
}

Jump to

Keyboard shortcuts

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