mycassandra

package
v0.0.0-...-43f4138 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Copyright 2017 by GoSpider author. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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