GithubHelp home page GithubHelp logo

支持ClickHouse about gorose HOT 4 CLOSED

gohouse avatar gohouse commented on May 13, 2024
支持ClickHouse

from gorose.

Comments (4)

fizzday avatar fizzday commented on May 13, 2024

@tlightsky 如果是符合database/sql接口标准的, 目前的都是可以用的. 直接注册一个对应的驱动即可.
同时, 驱动是分离的, 可以自由扩展驱动, 只需要实现最后的参数转换即可

from gorose.

fizzday avatar fizzday commented on May 13, 2024

@tlightsky 看了下, 貌似可以支持, 使用这个驱动 github.com/kshvakov/clickhouse, 然后添加一个驱动builder继承mysql的即可, 可以使用通用标准的sql, 特殊的sql, 需要执行 原生操作 Query(), Execute(), 如果确实要用, 你可以提交一个pr, 添加这个驱动, 或者我来加上也可以

connect, err := gorose.Open("clickhouse", "tcp://127.0.0.1:9000?debug=true")

from gorose.

tlightsky avatar tlightsky commented on May 13, 2024

对,我们现在用的就是这个驱动,
嗯,等你加哈,不是很熟悉

from gorose.

fizzday avatar fizzday commented on May 13, 2024

@tlightsky 我在builder目录增加了一个文件 clickhouse_builder.go ,使用的是mysql的解析标准, 只要是标准sql都可以直接使用.
你更新到最新的master分支试试. 内容如下:

package builder

import (
	"github.com/gohouse/gorose/across"
)

type ClickhouseBuilder struct {
}

func init()  {
	// 检查解析器是否实现了接口
	var builder IBuilder = &ClickhouseBuilder{}

	// 注册驱动
	Register("clickhouse", builder)
}

func (b ClickhouseBuilder) BuildQuery(api across.OrmApi) (sql string, err error) {
	return builders["mysql"].BuildQuery(api)
}

func (b ClickhouseBuilder) BuildExecute(api across.OrmApi, operType string) (string, error) {
	return builders["mysql"].BuildExecute(api, operType)
}

from gorose.

Related Issues (20)

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.