Code Monkey home page Code Monkey logo

dm-xorm's Introduction

dm-xorm

添加以后让xorm支持达梦数据库

引入方法

package main

import (
	"fmt"
	_ "gitee.com/chunanyong/dm" 
	"github.com/go-xorm/xorm"
	_ "github.com/sjm1327605995/dm-xorm"
	"xorm.io/core"
)

type Person struct {
	A string `xorm:"A"`
	B string `xorm:"B"`
	C string `xorm:"C"`
}

func main() {
	
	Engine, err := xorm.NewEngine("dm", "dm://SYSDBA:PASSWORD@IP:PORT")
	if err!=nil{
		fmt.Println(err)
		return
	}
	Engine.SetTableMapper(core.SameMapper{})
	Engine.ShowSQL(true)
	Engine.SetMaxOpenConns(5)
	Engine.SetMaxIdleConns(5)
	if err=Engine.Sync(new(Person));err!=nil{
  	fmt.Println(err)
		return
  }
}

代码存在的问题,达梦的没有json数据类型。利用xorm做数据库切换,注意json或者jsonb类型。xorm写法最好加上"",不然sql会被达梦解析成大写的。导致查询不到 达梦过长的字符串无法作为主键。

开源需要你的鼓励。如果有人能重写下dm的 链接host解析就更好了

dm-xorm's People

Contributors

sjm1327605995 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.