table

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: MIT Imports: 22 Imported by: 3

Documentation

Index

Constants

View Source
const MODULE = "table"

Variables

View Source
var Path = "tables"

Functions

func ApiCount

func ApiCount(ctx *gin.Context)

func ApiCreate

func ApiCreate(ctx *gin.Context)

func ApiDelete

func ApiDelete(ctx *gin.Context)

func ApiDetail

func ApiDetail(ctx *gin.Context)

func ApiExport

func ApiExport(ctx *gin.Context)

func ApiImport

func ApiImport(ctx *gin.Context)

func ApiSearch

func ApiSearch(ctx *gin.Context)

func ApiTableCreate

func ApiTableCreate(ctx *gin.Context)

func ApiTableList

func ApiTableList(ctx *gin.Context)

func ApiTableReload

func ApiTableReload(ctx *gin.Context)

func ApiTableRemove

func ApiTableRemove(ctx *gin.Context)

func ApiTableRename

func ApiTableRename(ctx *gin.Context)

func ApiUpdate

func ApiUpdate(ctx *gin.Context)

func Error

func Error(ctx *gin.Context, err error)

func Fail

func Fail(ctx *gin.Context, err string)

func FormFiles

func FormFiles(ctx *gin.Context) (files []*multipart.FileHeader, err error)

func List

func List(ctx *gin.Context, data any, total int64)

func Load

func Load(path string) error

func OK

func OK(ctx *gin.Context, data any)

func Register

func Register(table *Table)

func Scan

func Scan(dir string) error

func Startup

func Startup() error

func Sync

func Sync(tables []*Table) error

func TypeToSqlType

func TypeToSqlType(t string) (st schemas.SQLType)

Types

type Document

type Document map[string]any

type Field

type Field struct {
	Name       string `json:"name,omitempty"`
	Type       string `json:"type,omitempty"`
	Default    string `json:"default,omitempty"`
	NotNull    bool   `json:"not_null,omitempty"`
	Length     int64  `json:"length,omitempty"`
	Length2    int64  `json:"length2,omitempty"`
	PrimaryKey bool   `json:"primary_key,omitempty"`
	Increment  bool   `json:"increment,omitempty"`
	Indexed    bool   `json:"indexed,omitempty"`
	Created    bool   `json:"created,omitempty"`
	Updated    bool   `json:"updated,omitempty"`
}

type ReplyData

type ReplyData[T any] struct {
	Data  T      `json:"data"`
	Error string `json:"error,omitempty"`
}

type ReplyList

type ReplyList[T any] struct {
	Data  []T    `json:"data"`
	Total int64  `json:"total"`
	Error string `json:"error,omitempty"`
}

type Table

type Table struct {
	Name          string   `json:"name,omitempty"`
	Fields        []*Field `json:"fields,omitempty"`
	DisableInsert bool     `json:"disable_insert,omitempty"`
	DisableUpdate bool     `json:"disable_update,omitempty"`
	DisableDelete bool     `json:"disable_delete,omitempty"`
}

func Get

func Get(name string) (*Table, error)

func (*Table) Count

func (t *Table) Count(cond map[string]any) (cnt int64, err error)

func (*Table) Create

func (t *Table) Create() error

func (*Table) Delete

func (t *Table) Delete(cond map[string]any) (rows int64, err error)

func (*Table) DeleteById

func (t *Table) DeleteById(id string) (rows int64, err error)

func (*Table) Drop

func (t *Table) Drop() error

func (*Table) Find

func (t *Table) Find(cond map[string]any, fields []string, skip, limit int) (rows []map[string]any, err error)

func (*Table) Get

func (t *Table) Get(id string, fields []string) (Document, error)

func (*Table) Insert

func (t *Table) Insert(values map[string]any) (id any, err error)

func (*Table) Schema

func (t *Table) Schema() *schemas.Table

func (*Table) Update

func (t *Table) Update(cond map[string]any, values map[string]any) (rows int64, err error)

func (*Table) UpdateById

func (t *Table) UpdateById(id string, values map[string]any) (rows int64, err error)

Jump to

Keyboard shortcuts

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