orm

package
v1.3.26 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertAndReturnSlice added in v1.2.0

func AssertAndReturnSlice(targetType reflect.Type, value interface{}, e error) ([]interface{}, error)

func ORMTest

func ORMTest()

Types

type ORM

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

ORM struct encapsulates the metadata and methods for a table.

func Load

func Load(entity any) *ORM

Load initializes the ORM with the given struct.

func (*ORM) GetAll

func (o *ORM) GetAll() (any, error)

GetAll fetches all rows from the table.

func (*ORM) GetByFieldCompare added in v1.2.0

func (o *ORM) GetByFieldCompare(fieldName string, value any, operator string) (any, error)

func (*ORM) GetByFieldEquals added in v1.2.0

func (o *ORM) GetByFieldEquals(fieldName string, value any) (any, error)

func (*ORM) GetByFieldGreaterThan added in v1.2.0

func (o *ORM) GetByFieldGreaterThan(fieldName string, value any) (any, error)

func (*ORM) GetByFieldGreaterThanEquals added in v1.2.0

func (o *ORM) GetByFieldGreaterThanEquals(fieldName string, value any) (any, error)

func (*ORM) GetByFieldIn added in v1.2.0

func (o *ORM) GetByFieldIn(fieldName string, values []any) (any, error)

func (*ORM) GetByFieldLessThan added in v1.2.0

func (o *ORM) GetByFieldLessThan(fieldName string, value any) (any, error)

func (*ORM) GetByFieldLessThanEquals added in v1.2.0

func (o *ORM) GetByFieldLessThanEquals(fieldName string, value any) (any, error)

func (*ORM) GetByFieldLike added in v1.2.0

func (o *ORM) GetByFieldLike(fieldName string, value any) (any, error)

func (*ORM) GetByPrimaryKey

func (o *ORM) GetByPrimaryKey(key string) (any, error)

GetByPrimaryKey fetches a row by its primary key.

func (*ORM) GetCount added in v1.2.0

func (o *ORM) GetCount(fieldName string, value any, operator string) (int, error)

func (*ORM) Insert

func (o *ORM) Insert(entity any) error

Insert inserts a new row into the table.

func (*ORM) Update

func (o *ORM) Update(entity any, primaryKeyValue string) error

Update updates an existing row in the table.

type Service

type Service struct {
	TableName string    `karma_table:"services"`
	ServiceId string    `json:"service_id" karma:"primary;unique"`
	Type      string    `json:"type"` //"local", "online", "offline"
	Name      string    `json:"name"`
	Icon      string    `json:"icon"`
	Banner    string    `json:"banner"`
	Category  string    `json:"category"`   // "food", "clothing", "electronics", "services", "entertainment", "education", "health", "beauty", "travel", "venues
	OfferedBy string    `json:"offered_by"` // "global", "service_provider_id"
	Timestamp time.Time `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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