Skip to content

Commit d61ecbf

Browse files
committed
Initial implementation. Only Status API call supported
0 parents  commit d61ecbf

File tree

5 files changed

+418
-0
lines changed

5 files changed

+418
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*~
2+
*.[68]
3+
_obj
4+
main

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
include $(GOROOT)/src/Make.$(GOARCH)
2+
3+
TARG=net/sphinx
4+
GOFILES=sphinx.go
5+
6+
include $(GOROOT)/src/Make.pkg
7+
8+
main: package
9+
$(GC) -I_obj main.go
10+
$(LD) -L_obj -o $@ main.$O
11+
12+
format:
13+
gofmt -spaces=true -tabindent=false -tabwidth=4 -w sphinx.go
14+
gofmt -spaces=true -tabindent=false -tabwidth=4 -w test.go

README.markdown

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# gosphinx
2+
3+
[Go][Go] Clients and Connectors for [Sphinx][Sphinx].
4+
5+
# Getting started:
6+
7+
To build and install gosphinx, from the root directory of the git clone:
8+
9+
make install
10+
11+
## examples
12+
13+
After installing gosphinx (per above), try (again from the root dir of gosphinx):
14+
15+
make main && ./main
16+
17+
[Go]: http://golang.org/
18+
[Sphinx]: http://sphinxsearch.com/

main.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package main
2+
3+
import (
4+
"net/sphinx"
5+
"fmt"
6+
)
7+
8+
func main() {
9+
sphinx := sphinx.NewClient()
10+
sphinx.SetServer("127.0.0.1", 3312)
11+
12+
fmt.Println("Retrieving Sphinx status")
13+
status, err := sphinx.Status()
14+
if err != nil {
15+
fmt.Println("Error: ", err)
16+
} else {
17+
for i := 0; i < len(status); i++ {
18+
fmt.Printf("%20s %s\n", status[i][0] + ":", status[i][1])
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)