mycassandra

package
v0.0.0-...-6af97ad Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

cassandra操作工具类

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cdb

type Cdb struct {
	*Config
	// contains filtered or unexported fields
}

这是一个重要的结构体,cassandra连接包装于此 cassandra client

func New

func New(c *Config) (cdb *Cdb)

别名,为了容易使用 alias name easy use

func NewCdb

func NewCdb(host []string, keyspace string) (cdb *Cdb)

一般初始化连接 init cdb just these

func NewCdbWithConf

func NewCdbWithConf(c *Config) (cdb *Cdb)

配置初始化连接 init cassandra by config

func (*Cdb) Connect

func (self *Cdb) Connect()

连接,出错panic before use must connect,error will be panic,oh!

func (*Cdb) Exec

func (c *Cdb) Exec(q *gocql.Query) error

使用上面的查询语句,开始执行,一般是插入操作 Query() then can Exec just for insert

func (*Cdb) Iter

func (c *Cdb) Iter(q *gocql.Query) *gocql.Iter

使用上面的查询语句,开始执行,一般是查找操作 Query() then real query,see test

func (*Cdb) Query

func (c *Cdb) Query(stmt string, values ...interface{}) *gocql.Query

构造查询语句,包括插入,查找,不仅仅是查询 create a cassnara sql,not just for query can be insert

type Config

type Config struct {
	Host     []string
	Keyspace string
}

配置特别简单,主机名和keyspace cassand config, just need host and keyspace

Jump to

Keyboard shortcuts

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