t38c

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 6 Imported by: 0

README

Overview

PkgGoDev License Version Status Codecov

t38c is a Go client library for the Tile38 geospatial database.

Usage

import kreklow.us/go/t38c

Use Connect() to instantiate a Database object. A limited set of commands are currently available. Commands that retrieve data return a Response object.

Functions other than Close() accept arguments in the same form as the Tile38 CLI. See Tile38 Commands for further information.

About

t38c is maintained by Collin Kreklow. The source code is licensed under the terms of the MIT license, see LICENSE.txt for further information.

Documentation

Overview

Package t38c implements client for working with a Tile38 database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

Database is the primary object for interacting with the database. Database should not be created directly, instead use Connect() to retrieve a fully-initialized Database ready to be used.

Functions other than Close() accept arguments in the same form as the Tile38 CLI. See https://tile38.com/commands/ for further information.

func Connect

func Connect(server string, port string, poolsize int) (db *Database, err error)

Connect establishes a connection and returns a Database object.

func (*Database) Close

func (db *Database) Close() error

Close closes the database connection.

func (*Database) Del

func (db *Database) Del(key string, id string) (err error)

Del deletes the requested entry.

func (*Database) Expire

func (db *Database) Expire(key string, id string, seconds int) (err error)

Expire sets or resets the timeout value on the requested entry.

func (*Database) Get

func (db *Database) Get(key string, id string, args ...string) (r *Response, err error)

Get returns the requested entry as a response object, or nil if the object is not found.

func (*Database) PDel

func (db *Database) PDel(key string, pattern string) (err error)

PDel deletes any entries matching the supplied pattern.

func (*Database) Persist

func (db *Database) Persist(key string, id string) (err error)

Persist removes the timeout value on the requested entry.

func (*Database) Scan

func (db *Database) Scan(key string, args ...string) (r *Response, err error)

Scan iterates through a key returning a set of results.

func (*Database) Search

func (db *Database) Search(key string, args ...string) (r *Response, err error)

Search iterates through the string values of a key returning a set of results.

func (*Database) Set

func (db *Database) Set(key string, id string, args ...string) (err error)

Set saves an object to the database.

func (*Database) TTL

func (db *Database) TTL(key string, id string) (ttl float64, err error)

TTL returns the timeout value on the requested entry.

type Response

type Response struct {
	ID          string
	Object      string
	IDs         []string
	Objects     []string
	FieldNames  map[string]int64
	FieldValues []float64
	Count       int64
	Cursor      int64
	TTL         float64
	Err         string
	Elapsed     string
	Ok          bool

	Live    bool
	Command string
	Group   string
	Detect  string
	Key     string
	Time    time.Time
	// contains filtered or unexported fields
}

Response represents a database response.

func (*Response) UnmarshalText

func (r *Response) UnmarshalText(b []byte) (err error)

UnmarshalText implements the ability to unmarshal a database response.

Directories

Path Synopsis
internal
mock
Package mock provides a mock Tile38 server for testing.
Package mock provides a mock Tile38 server for testing.

Jump to

Keyboard shortcuts

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