Documentation ¶
Index ¶
- func CreateCouchDBServer(ctx context.Context) (testcontainers.Container, error)
- type ClusterInfo
- type CouchDatabaseInfo
- type DatabaseConfig
- type DatabaseProperty
- type DatabaseSizes
- type DatabaseStore
- func DataStore[T interface{}](prefix string) DatabaseStore[T]
- func GetDataStoreByDatabaseName[T interface{}](databaseName string) (*DatabaseStore[T], error)
- func New[T interface{}](name string, url string, user string, pswd string) DatabaseStore[T]
- func NewDataStore[T interface{}](config *DatabaseConfig) DatabaseStore[T]
- func (ds DatabaseStore[T]) CouchDBUp() bool
- func (ds DatabaseStore[T]) DatabaseCreate() bool
- func (ds DatabaseStore[T]) DatabaseExists() (*CouchDatabaseInfo, error)
- func (ds DatabaseStore[T]) DocumentCreate(key string, document *T) (string, error)
- func (ds DatabaseStore[T]) DocumentDelete(key string, revision string) (string, error)
- func (ds DatabaseStore[T]) DocumentGet(key string) (*T, error)
- func (ds DatabaseStore[T]) DocumentUpdate(key string, revision string, document *T) (string, error)
- func (ds DatabaseStore[T]) GetConfig() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCouchDBServer ¶
CreateCouchDBServer I put this here so that other test packages can use it.
Types ¶
type ClusterInfo ¶
type CouchDatabaseInfo ¶
type CouchDatabaseInfo struct { DatabaseName string `json:"db_name"` PurgeSequence string `json:"purge_seq"` UpdateSequence string `json:"update_seq"` Sizes DatabaseSizes `json:"sizes"` Properties DatabaseProperty `json:"props"` DocumentDeleteCount int64 `json:"doc_del_count"` DocumentCount int64 `json:"doc_count"` Cluster ClusterInfo `json:"cluster"` DiskFormatVersion int `json:"disk_format_version"` CompactRunning bool `json:"compact_running"` }
type DatabaseConfig ¶
type DatabaseConfig struct { DatabaseName string `envconfig:"COUCHDB_DATABASE",required:"true"` CouchDBUrl string `envconfig:"COUCHDB_URL",default:"http://localhost:5984"` Username string `envconfig:"COUCHDB_USER",default:"admin"` Password string `envconfig:"COUCHDB_PASSWORD",default:"password"` }
func NewDatabaseConfig ¶
func NewDatabaseConfig(prefix string) (*DatabaseConfig, error)
func (DatabaseConfig) DocumentURL ¶
func (dc DatabaseConfig) DocumentURL(key string) string
type DatabaseProperty ¶
type DatabaseProperty struct {
Partitioned bool `json:"partitioned"`
}
type DatabaseSizes ¶
type DatabaseStore ¶
type DatabaseStore[T interface{}] struct {
// contains filtered or unexported fields
}
func DataStore ¶
func DataStore[T interface{}](prefix string) DatabaseStore[T]
func GetDataStoreByDatabaseName ¶
func GetDataStoreByDatabaseName[T interface{}](databaseName string) (*DatabaseStore[T], error)
func New ¶
func New[T interface{}](name string, url string, user string, pswd string) DatabaseStore[T]
func NewDataStore ¶
func NewDataStore[T interface{}](config *DatabaseConfig) DatabaseStore[T]
func (DatabaseStore[T]) CouchDBUp ¶
func (ds DatabaseStore[T]) CouchDBUp() bool
func (DatabaseStore[T]) DatabaseCreate ¶
func (ds DatabaseStore[T]) DatabaseCreate() bool
func (DatabaseStore[T]) DatabaseExists ¶
func (ds DatabaseStore[T]) DatabaseExists() (*CouchDatabaseInfo, error)
func (DatabaseStore[T]) DocumentCreate ¶
func (ds DatabaseStore[T]) DocumentCreate(key string, document *T) (string, error)
func (DatabaseStore[T]) DocumentDelete ¶
func (ds DatabaseStore[T]) DocumentDelete(key string, revision string) (string, error)
func (DatabaseStore[T]) DocumentGet ¶
func (ds DatabaseStore[T]) DocumentGet(key string) (*T, error)
func (DatabaseStore[T]) DocumentUpdate ¶
func (ds DatabaseStore[T]) DocumentUpdate(key string, revision string, document *T) (string, error)
func (DatabaseStore[T]) GetConfig ¶
func (ds DatabaseStore[T]) GetConfig() string
Click to show internal directories.
Click to hide internal directories.