dao

package
v0.0.0-...-3cf4c9a Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, dao Dao)

Register makes a config adapter available by the adapter name. If Register is called twice with the same name or if driver is nil, it panics.

Types

type AddSolr

type AddSolr struct {
	Add struct {
		CommitWithin int  `json:"commitWithin"`
		Doc          Post `json:"doc"`
		Overwrite    bool `json:"overwrite"`
	} `json:"add"`
}

type Dao

type Dao interface {
	NewDaoImpl(dsn string) (DaoContainer, error)
}

type DaoContainer

type DaoContainer interface {
	AddPost(p *Post)
	AddPosts(p []Post)
	DelPost(id interface{})
	DelPosts(source string)
	UpdatePost(p *Post)
	AddOrUpdate(p *Post)
	GetPostById(id int) *Post
	GetPostByLink(url string) *Post
	GetPost(author, sort string, limit, start int) []Post
	IsPostUpdate(p *Post) bool
	Search(q string, limit, start int) (int, float64, []Post)
	Debug(is_debug bool)
}

func NewDao

func NewDao(dao_name, dsn string) (DaoContainer, error)

type DelSolr

type DelSolr struct {
	Del struct {
		Query        string `json:"query"`
		CommitWithin int    `json:"commitWithin"`
	} `json:"delete"`
}

type SolrDao

type SolrDao struct {
	Dsn string
}

func (*SolrDao) NewDaoImpl

func (this *SolrDao) NewDaoImpl(dsn string) (DaoContainer, error)

type SolrDaoContainer

type SolrDaoContainer struct {
	// contains filtered or unexported fields
}

func (*SolrDaoContainer) AddOrUpdate

func (this *SolrDaoContainer) AddOrUpdate(p *Post)

func (*SolrDaoContainer) AddPost

func (this *SolrDaoContainer) AddPost(p *Post)

func (*SolrDaoContainer) AddPosts

func (this *SolrDaoContainer) AddPosts(p []Post)

func (*SolrDaoContainer) Debug

func (this *SolrDaoContainer) Debug(is_debug bool)

func (*SolrDaoContainer) DelPost

func (this *SolrDaoContainer) DelPost(id interface{})

func (*SolrDaoContainer) DelPosts

func (this *SolrDaoContainer) DelPosts(source string)

func (*SolrDaoContainer) GetPost

func (this *SolrDaoContainer) GetPost(author, sort string, limit, start int) []Post

func (*SolrDaoContainer) GetPostById

func (this *SolrDaoContainer) GetPostById(id int) *Post
func (this *SolrDaoContainer) GetPostByLink(url string) *Post

func (*SolrDaoContainer) IsPostUpdate

func (this *SolrDaoContainer) IsPostUpdate(p *Post) bool

func (*SolrDaoContainer) Search

func (this *SolrDaoContainer) Search(q string, limit, start int) (int, float64, []Post)

func (*SolrDaoContainer) UpdatePost

func (this *SolrDaoContainer) UpdatePost(p *Post)

type SolrError

type SolrError struct {
	Msg  string `json:"msg"`
	Code int    `json:"code"`
}

type SolrPost

type SolrPost struct {
	Response struct {
		Docs     []Post `json:"docs"`
		NumFound int    `json:"numFound"`
		Start    int    `json:"start"`
	} `json:"response"`
	ResponseHeader SolrResponseHeader             `json:"responseHeader"`
	Error          SolrError                      `json:"error"`
	Highlighting   map[string]map[string][]string `json:"highlighting"`
}

type SolrResponseHeader

type SolrResponseHeader struct {
	QTime  float64 `json:"QTime"`
	Params struct {
		Indent string `json:"indent"`
		Q      string `json:"q"`
		Wt     string `json:"wt"`
	} `json:"params"`
	Status int `json:"status"`
}

Jump to

Keyboard shortcuts

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