Documentation ¶
Overview ¶
Copyright 2021 Layotto Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 Layotto Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 Layotto Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 Layotto Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 Layotto Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 Layotto Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 Layotto Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func GetMiliTimestamp(i int64) int64
- func GetReadConcrenObject(cn string) (*readconcern.ReadConcern, error)
- func GetWriteConcernObject(cn string) (*writeconcern.WriteConcern, error)
- func NewClusterRedisClient(m RedisClusterMetadata) []*redis.Client
- func NewEtcdClient(meta EtcdMetadata) (*clientv3.Client, error)
- func NewMySQLClient(meta MySQLMetadata) error
- func NewRedisClient(m RedisMetadata) *redis.Client
- func SetConcern(m MongoMetadata) (*options.CollectionOptions, error)
- type ConnectionFactory
- type ConnectionFactoryImpl
- type ConsulClient
- type ConsulKV
- type ConsulMetadata
- type EtcdMetadata
- type Item
- type MongoClient
- type MongoCollection
- type MongoFactory
- type MongoFactoryImpl
- func (c *MongoFactoryImpl) NewMongoClient(m MongoMetadata) (MongoClient, error)
- func (c *MongoFactoryImpl) NewMongoCollection(m *mongo.Database, collectionName string, opts *options.CollectionOptions) MongoCollection
- func (c *MongoFactoryImpl) NewSingleResult(sr *mongo.SingleResult) MongoSingleResult
- type MongoMetadata
- type MongoSession
- type MongoSingleResult
- type MySQLMetadata
- type OssMetadata
- type RedisClusterMetadata
- type RedisMetadata
- type SessionFactory
- type ZKConnection
- type ZookeeperMetadata
Constants ¶
This section is empty.
Variables ¶
var (
Db *sql.DB
)
var (
ErrNotInitClient = errors.New("oss client not init")
)
Functions ¶
func GetMiliTimestamp ¶
func GetReadConcrenObject ¶
func GetReadConcrenObject(cn string) (*readconcern.ReadConcern, error)
func GetWriteConcernObject ¶
func GetWriteConcernObject(cn string) (*writeconcern.WriteConcern, error)
func NewClusterRedisClient ¶
func NewClusterRedisClient(m RedisClusterMetadata) []*redis.Client
func NewEtcdClient ¶
func NewEtcdClient(meta EtcdMetadata) (*clientv3.Client, error)
func NewMySQLClient ¶
func NewMySQLClient(meta MySQLMetadata) error
func NewRedisClient ¶
func NewRedisClient(m RedisMetadata) *redis.Client
func SetConcern ¶
func SetConcern(m MongoMetadata) (*options.CollectionOptions, error)
Types ¶
type ConnectionFactory ¶
type ConnectionFactory interface {
NewConnection(expire time.Duration, meta ZookeeperMetadata) (ZKConnection, error)
}
type ConnectionFactoryImpl ¶
type ConnectionFactoryImpl struct { }
func (*ConnectionFactoryImpl) NewConnection ¶
func (c *ConnectionFactoryImpl) NewConnection(expire time.Duration, meta ZookeeperMetadata) (ZKConnection, error)
type ConsulClient ¶
type ConsulMetadata ¶
func ParseConsulMetadata ¶
func ParseConsulMetadata(meta lock.Metadata) (ConsulMetadata, error)
type EtcdMetadata ¶
type EtcdMetadata struct { KeyPrefix string DialTimeout int Endpoints []string Username string Password string TlsCa string TlsCert string TlsCertKey string }
func ParseEtcdMetadata ¶
func ParseEtcdMetadata(properties map[string]string) (EtcdMetadata, error)
type Item ¶
type Item struct { Key string `bson:"_id"` Value interface{} `bson:"value"` Etag string `bson:"_etag"` }
Item is Mongodb document wrapper.
type MongoClient ¶
type MongoCollection ¶
type MongoCollection interface { FindOne(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult InsertOne(ctx context.Context, document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error) Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error) Indexes() mongo.IndexView UpdateOne(ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) FindOneAndUpdate(ctx context.Context, filter interface{}, update interface{}, opts ...*options.FindOneAndUpdateOptions) *mongo.SingleResult }
func SetCollection ¶
func SetCollection(c MongoClient, f MongoFactory, m MongoMetadata) (MongoCollection, error)
type MongoFactory ¶
type MongoFactory interface { NewMongoClient(m MongoMetadata) (MongoClient, error) NewMongoCollection(m *mongo.Database, collectionName string, opts *options.CollectionOptions) MongoCollection NewSingleResult(sr *mongo.SingleResult) MongoSingleResult }
type MongoFactoryImpl ¶
type MongoFactoryImpl struct{}
func (*MongoFactoryImpl) NewMongoClient ¶
func (c *MongoFactoryImpl) NewMongoClient(m MongoMetadata) (MongoClient, error)
func (*MongoFactoryImpl) NewMongoCollection ¶
func (c *MongoFactoryImpl) NewMongoCollection(m *mongo.Database, collectionName string, opts *options.CollectionOptions) MongoCollection
func (*MongoFactoryImpl) NewSingleResult ¶
func (c *MongoFactoryImpl) NewSingleResult(sr *mongo.SingleResult) MongoSingleResult
type MongoMetadata ¶
type MongoMetadata struct { Host string Username string Password string DatabaseName string CollectionName string Server string Params string WriteConcern string ReadConcern string OperationTimeout time.Duration }
func ParseMongoMetadata ¶
func ParseMongoMetadata(properties map[string]string) (MongoMetadata, error)
type MongoSession ¶
type MongoSingleResult ¶
type MySQLMetadata ¶
type MySQLMetadata struct { TableName string DataBaseName string UserName string Password string MysqlUrl string Db *sql.DB }
func ParseMySQLMetadata ¶
func ParseMySQLMetadata(properties map[string]string) (MySQLMetadata, error)
type OssMetadata ¶
type OssMetadata struct { Endpoint string `json:"endpoint"` AccessKeyID string `json:"accessKeyID"` AccessKeySecret string `json:"accessKeySecret"` Region string `json:"region"` }
OssMetadata wraps the configuration of oss implementation
type RedisClusterMetadata ¶
type RedisClusterMetadata struct { Hosts []string Concurrency int Password string MaxRetries int MaxRetryBackoff time.Duration EnableTLS bool DB int }
func ParseRedisClusterMetadata ¶
func ParseRedisClusterMetadata(properties map[string]string) (RedisClusterMetadata, error)
type RedisMetadata ¶
type RedisMetadata struct { Host string Password string MaxRetries int MaxRetryBackoff time.Duration EnableTLS bool DB int }
func ParseRedisMetadata ¶
func ParseRedisMetadata(properties map[string]string) (RedisMetadata, error)
type SessionFactory ¶
type SessionFactory interface { Create(se *api.SessionEntry, q *api.WriteOptions) (string, *api.WriteMeta, error) Destroy(id string, q *api.WriteOptions) (*api.WriteMeta, error) }
type ZKConnection ¶
type ZookeeperMetadata ¶
type ZookeeperMetadata struct { Hosts []string Password string SessionTimeout time.Duration LogInfo bool }
func ParseZookeeperMetadata ¶
func ParseZookeeperMetadata(properties map[string]string) (ZookeeperMetadata, error)