Code Monkey home page Code Monkey logo

orm-packaging's Introduction

Go Report Card

目的

本项目主要针对平时使用的xorm、beego orm做了简单封装

  • 对复杂操作进行包装
  • 简化代码复杂度,提高代码重用率
  • 增加分页功能,更贴切实际项目使用

xorm

gorm

beego orm

Insert

添加记录并返回持久化的记录

Insert(v interface)

Query

根据指定字段进行查询

Read(v interface, cols ...string)

Query By Page

分页查询

// condition eg:map[string]interface{}{"age__gt":1, "name__icontains":"mojo", "sex":1} 查找age大于1 & name包含mojo & sex为1的记录
QueryElement(page *pagination.Pagination, condition map[string]interface{}, table interface{})

Delete

删除指定的记录

// 根据指定cols作为条件进行删除
Delete(v interface, cols ...string)

Update

更新记录

// 更新指定字段
Update(v interface, cols ...string)

Update with map

以map作为对象来更新

// condition 为条件  m为将要更新的值 table为指定表对应的实体类  调用该方法后持久化后的对象将会赋值给table
UpdateWithMap(condition, m map[string]interface{}, table interface{})

orm-packaging's People

Contributors

mojo-zd avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

aland-zhang

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.