dynamo

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dynamo

type Dynamo[T StorableDynamo] struct {
	// contains filtered or unexported fields
}

func CreateDynamoTable

func CreateDynamoTable[T StorableDynamo](tableName string, db *dynamo.DB) (Dynamo[T], error)

func (*Dynamo[T]) Delete

func (d *Dynamo[T]) Delete(hash string) (T, error)

func (*Dynamo[T]) Get

func (d *Dynamo[T]) Get(hash string) (T, error)

func (*Dynamo[T]) Put

func (d *Dynamo[T]) Put(item T) error

func (*Dynamo[T]) QueryBy

func (d *Dynamo[T]) QueryBy(parameter string, queryBy interface{}, indexName string, filter FilterData, rangeData *RangeData, asc *bool, limit int) ([]T, error)

QueryBy used to get multiple results of a query, if error then something happened with dynamo. If found none value, then empty array is returned parameter: The id from which you want to start fetching, this is thought as a method which will always have a parameter and a value to search by queryBy: The value of previous parameter indexName: the name of the index to look for, if empty normal index used filter: a filter if necessary, this has to be a query, for example "'someValue' > ?" and the ? will be replaced for the values in filterValues rangeData

func (*Dynamo[T]) Scan

func (d *Dynamo[T]) Scan(query string, valuesToFilter []interface{}) ([]T, error)

type FilterData added in v0.3.0

type FilterData struct {
	FilterQuery  string
	FilterValues []interface{}
}

type RangeData added in v0.3.0

type RangeData struct {
	RangeName  string
	RangeValue []interface{}
	Operator   dynamo.Operator
}

type StorableDynamo

type StorableDynamo interface {
	GetTableId() string
}

type Table

type Table[T StorableDynamo] interface {
	Put(item T) error
	Get(hash string) (T, error)
	Delete(hash string) (T, error)
	QueryBy(parameter string, queryBy interface{}, indexName string, filter FilterData, rangeData *RangeData, asc *bool, limit int) ([]T, error)
	Scan(query string, valuesToFilter []interface{}) ([]T, error)
}

Jump to

Keyboard shortcuts

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