nosql

package
v0.0.0-...-ff2bd9c Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GoTypeMapToCQLType map[string]string = map[string]string{
		"Time":    "TIMESTAMP",
		"UUID":    "UUID",
		"string":  "TEXT",
		"int":     "INT",
		"int32":   "INT",
		"int64":   "BIGINT",
		"float32": "FLOAT",
		"float64": "FLOAT",
		"bool":    "BOOLEAN",
		"[]byte":  "BLOB",
	}
)

Functions

func ConvertToArrayInterface

func ConvertToArrayInterface(arrayPointerStruct interface{}) []interface{}

func GetPropertyNameTolowerCaseMapping

func GetPropertyNameTolowerCaseMapping(obj interface{}) (map[string]string, error)

GetPropertyNameToUpperCaseMapping returns a map of property names in upper case for the given struct.

func GetPropertyNamesAndValues

func GetPropertyNamesAndValues(data interface{}) ([]string, []interface{}, error)

func MigrateTable

func MigrateTable(session *gocql.Session, keySpace string, entity interface{}) error

func NewMutableRepository

func NewMutableRepository(db *gocql.Session, keySpace string) repository.MutableGenericRepositoryInterface

DO NOT USE Pointer for nosql (Cassandra) object due to migration issue, please use cast library to casting object do not rely on result due type mismatch, deleted process need to be adjusted later, for now it would be hard delete

func NewRepository

func NewRepository(db *gocql.Session, keySpace string) repository.GenericRepositoryInterface

DO NOT USE Pointer for nosql (Cassandra) object due to migration issue, please use cast library to casting object do not rely on result due type mismatch, deleted process need to be adjusted later, for now it would be hard delete

func StructToMap

func StructToMap(obj interface{}) (map[string]interface{}, error)

StructToMap converts a pointer to a struct into a map[string]interface{}

Types

type GenericRepository

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

func (*GenericRepository) BulkInsert

func (r *GenericRepository) BulkInsert(ctx context.Context, data interface{}) (interface{}, error)

func (*GenericRepository) BulkUpsert

func (r *GenericRepository) BulkUpsert(ctx context.Context, data interface{}) (interface{}, error)

func (*GenericRepository) Delete

func (r *GenericRepository) Delete(ctx context.Context, data interface{}) (interface{}, error)

func (*GenericRepository) FindAll

func (r *GenericRepository) FindAll(ctx context.Context, params map[string]interface{}, conditionalOperations []repository.ConditionalOperation, relationalOperations []repository.RelationalOperation, page int, limit int, result interface{}) (interface{}, error)

FindAll for IN params please pass the object directly without parsing to string

func (*GenericRepository) FindByID

func (r *GenericRepository) FindByID(ctx context.Context, id uuid.UUID, result interface{}) (interface{}, error)

func (*GenericRepository) FindOne

func (r *GenericRepository) FindOne(ctx context.Context, key string, value interface{}, result interface{}) (interface{}, error)

func (*GenericRepository) Insert

func (r *GenericRepository) Insert(ctx context.Context, data interface{}) (interface{}, error)

func (*GenericRepository) Query

func (r *GenericRepository) Query(ctx context.Context, query string, params []interface{}, result interface{}) (interface{}, error)

func (*GenericRepository) Update

func (r *GenericRepository) Update(ctx context.Context, data interface{}) (interface{}, error)

func (*GenericRepository) Upsert

func (r *GenericRepository) Upsert(ctx context.Context, data interface{}) (interface{}, error)

Directories

Path Synopsis
We create this empty file as the workaround for this bug: https://github.com/golang/go/issues/27333
We create this empty file as the workaround for this bug: https://github.com/golang/go/issues/27333

Jump to

Keyboard shortcuts

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