orm

package
v1.1.12 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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) GetByPrimaryKey

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

GetByPrimaryKey fetches a row by its primary key.

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