goar

package
v0.0.0-...-711f10a Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2017 License: GPL-2.0, GPL-2.0 Imports: 7 Imported by: 0

README

goar: An active recordesque framework for golang

Supports go 1.2 or later

Documentation

(coming soon)

Installation

go get -u github.com/obieq/goar
import "github.com/obieq/goar"

Examples

(coming soon)

Detailed examples can be found in the Orchestrate test files

Tests

go test -cover
      or
ginkgo -cover

Documentation

Index

Constants

View Source
const COUCHBASE = "couchbase"
View Source
const DYNAMODB = "dynamodb"
View Source
const MSSQL = "mssql"
View Source
const ORCHESTRATE = "orchestrate"
View Source
const POSTGRESQL = "postgresql"
View Source
const RETHINKDB = "rethinkdb"

Variables

View Source
var Config *config

Functions

func Callback

func Callback(name string, eptr reflect.Value, arg []reflect.Value) error

Types

type ActiveRecord

type ActiveRecord struct {
	validations.Validation
	// contains filtered or unexported fields
}

func (*ActiveRecord) Delete

func (ar *ActiveRecord) Delete() error

func (*ActiveRecord) Distinct

func (ar *ActiveRecord) Distinct() *ActiveRecord

func (*ActiveRecord) Errors

func (ar *ActiveRecord) Errors() map[string]*validations.ValidationError

func (*ActiveRecord) ModelName

func (ar *ActiveRecord) ModelName() string

func (*ActiveRecord) Order

func (ar *ActiveRecord) Order(orderBy OrderBy) *ActiveRecord

func (*ActiveRecord) Pluck

func (ar *ActiveRecord) Pluck(keys ...interface{}) *ActiveRecord

func (*ActiveRecord) Query

func (ar *ActiveRecord) Query() *Query

func (*ActiveRecord) Run

func (ar *ActiveRecord) Run(results interface{}) error

func (*ActiveRecord) Save

func (ar *ActiveRecord) Save() (success bool, err error)

func (*ActiveRecord) Self

func (*ActiveRecord) SetQuery

func (ar *ActiveRecord) SetQuery(query *Query)

func (*ActiveRecord) SetSelf

func (ar *ActiveRecord) SetSelf(ari ActiveRecordInterfacer)

func (*ActiveRecord) Sum

func (ar *ActiveRecord) Sum(fields ...interface{}) *ActiveRecord

func (*ActiveRecord) Valid

func (ar *ActiveRecord) Valid() bool

func (*ActiveRecord) Where

func (ar *ActiveRecord) Where(where QueryCondition) *ActiveRecord

type ActiveRecordInterfacer

type ActiveRecordInterfacer interface {
	Validater
	Querier
	ModelName() string
	DBConnectionName() string        // EX: aws1, aws2, azure1, azure2, default
	DBConnectionEnvironment() string // EX: dev, qa, ci, prod
	SetKey(string)
	//PrimaryKey() string
	Self() ActiveRecordInterfacer
	SetSelf(ActiveRecordInterfacer)
	//Query() *Query
	//SetQuery(*Query)
	Truncate() (numRowsDeleted int, err error)
	All(results interface{}, opts map[string]interface{}) error
	Find(id interface{}, out interface{}) error
	Save() (success bool, err error)
	Delete() error
}

type CouchbaseConfig

type CouchbaseConfig struct {
	ConnectionName string
	ClusterAddress string
	BucketName     string
	BucketPassword string
}

CouchbaseConfig => contains couchbase db connection info

type CustomModelNamer

type CustomModelNamer interface {
	CustomModelName() string
}

type DynamoDBConfig

type DynamoDBConfig struct {
	ConnectionName string
	Region         string
	AccessKey      string
	SecretKey      string
}

DynamoDBConfig => contains dynamodb db connection info

type EnumAggregations

type EnumAggregations int
const (
	SUM EnumAggregations
	GROUP
)

type EnumLogicalOperators

type EnumLogicalOperators int
const (
	OR EnumLogicalOperators
	AND
	NOT
)

type EnumRelationalOperators

type EnumRelationalOperators int
const (
	EQ  EnumRelationalOperators // equal
	NE                          // not equal
	LT                          // less than
	LTE                         // less than or equal
	GT                          // greater than
	GTE                         // greater than or equal
	IN
)

type EnumSortOrders

type EnumSortOrders int
const (
	ASC EnumSortOrders
	DESC
)

type MSSQLConfig

type MSSQLConfig struct {
	ConnectionName     string
	Server             string
	Port               int
	DBName             string
	Username           string
	Password           string
	MaxIdleConnections int
	MaxOpenConnections int
	Debug              bool
}

MSSQLConfig => contains mssql db connection info

type OrchestrateConfig

type OrchestrateConfig struct {
	ConnectionName string
	APIKey         string
}

OrchestrateConfig => contains orchestrate db connection info

type OrderBy

type OrderBy struct {
	Key       string
	SortOrder EnumSortOrders
}

type Persister

type Persister interface {
	DbSave() (err error)
	DbDelete() (err error)
	DbSearch(results interface{}) error
}

type PostgresqlDBConfig

type PostgresqlDBConfig struct {
	ConnectionName     string
	Server             string
	Port               int
	DBName             string
	Username           string
	Password           string
	MaxIdleConnections int
	MaxOpenConnections int
	Debug              bool
}

PostgresqlDBConfig => contains postgresql db connection info

type Querier

type Querier interface {
	Query() *Query
	SetQuery(*Query)
	Pluck(...interface{}) *ActiveRecord
	Where(QueryCondition) *ActiveRecord
	Order(OrderBy) *ActiveRecord
	Sum(fields ...interface{}) *ActiveRecord
	Distinct() *ActiveRecord
	//Or(QueryCondition) *ActiveRecord
	Run(results interface{}) error
}

type Query

type Query struct {
	//db              *DB
	//OrConditions    []QueryCondition
	//NotConditions   []QueryCondition
	Plucks          []interface{}
	WhereConditions []QueryCondition
	OrderBys        []OrderBy
	Joins           string
	Offset          string
	Limit           string
	Aggregations    map[EnumAggregations][]interface{}
	Distinct        bool
	// contains filtered or unexported fields
}

func NewQuery

func NewQuery() *Query

type QueryCondition

type QueryCondition struct {
	LogicalOperator    EnumLogicalOperators
	Key                string
	RelationalOperator EnumRelationalOperators
	Value              interface{}
}

type RDBMSer

type RDBMSer interface {
	SpExecResultSet(spName string, params map[string]interface{}, results interface{}) error
}

type RethinkDBConfig

type RethinkDBConfig struct {
	ConnectionName     string
	Addresses          []string
	DBName             string
	AuthKey            string
	DiscoverHosts      bool
	MaxIdleConnections int
	MaxOpenConnections int
	Debug              bool
}

RethinkDBConfig => contains rethinkdb db connection info

type Timestamps

type Timestamps struct {
	CreatedAt *time.Time `json:"created_at,omitempty"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
}

type Validater

type Validater interface {
	Valid() bool
	Validate()
	Errors() map[string]*validations.ValidationError
}

Directories

Path Synopsis
db
tests

Jump to

Keyboard shortcuts

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