orm

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Binds

func Binds[T ITable](m T) []interface{}

Types

type ITable

type ITable interface {
	TableName() string
	Pk() string
}

type ORM

type ORM[T ITable] struct {
	Record T
}

func NewORM

func NewORM[T ITable](data T) *ORM[T]

func (*ORM[T]) Count

func (c *ORM[T]) Count(where string, values []interface{}) (int64, error)

func (*ORM[T]) Fields

func (c *ORM[T]) Fields() string

func (*ORM[T]) Limit

func (c *ORM[T]) Limit(where string, values []interface{}, offset, size int64, order string) ([]T, error)

func (*ORM[T]) Pk

func (c *ORM[T]) Pk() string

func (*ORM[T]) Row

func (c *ORM[T]) Row(where string, values []interface{}) (T, error)

func (*ORM[T]) Rows

func (c *ORM[T]) Rows(where string, values []interface{}) ([]T, error)

func (*ORM[T]) Save

func (c *ORM[T]) Save() (int64, error)

func (*ORM[T]) Saves

func (c *ORM[T]) Saves(rows []T) (int64, error)

func (*ORM[T]) TableName

func (c *ORM[T]) TableName() string

func (*ORM[T]) Update

func (c *ORM[T]) Update(pk int64) (int64, error)

func (*ORM[T]) UpdateByPk

func (c *ORM[T]) UpdateByPk(data map[string]interface{}, pk int64) (int64, error)

Jump to

Keyboard shortcuts

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