primaryreplica¶
import "github.com/go-rel/primaryreplica"
Overview¶
func New¶
func New(primary rel.Adapter, replicas ...rel.Adapter) rel.Adapter
type PrimaryReplica¶
type PrimaryReplica struct {
// contains filtered or unexported fields
}
func (*PrimaryReplica) Aggregate¶
func (pr *PrimaryReplica) Aggregate(ctx context.Context, query rel.Query, mode string, field string) (int, error)
func (*PrimaryReplica) Apply¶
func (pr *PrimaryReplica) Apply(ctx context.Context, migration rel.Migration) error
func (*PrimaryReplica) Begin¶
func (pr *PrimaryReplica) Begin(ctx context.Context) (rel.Adapter, error)
func (*PrimaryReplica) Close¶
func (pr *PrimaryReplica) Close() error
func (*PrimaryReplica) Commit¶
func (pr *PrimaryReplica) Commit(ctx context.Context) error
func (*PrimaryReplica) Delete¶
func (pr *PrimaryReplica) Delete(ctx context.Context, query rel.Query) (int, error)
func (*PrimaryReplica) Exec¶
func (pr *PrimaryReplica) Exec(ctx context.Context, stmt string, args []interface{}) (int64, int64, error)
func (*PrimaryReplica) Insert¶
func (pr *PrimaryReplica) Insert(ctx context.Context, query rel.Query, primaryField string, mutates map[string]rel.Mutate, onConflict rel.OnConflict) (interface{}, error)
func (*PrimaryReplica) InsertAll¶
func (pr *PrimaryReplica) InsertAll(ctx context.Context, query rel.Query, primaryField string, fields []string, bulkMutates []map[string]rel.Mutate, onConflict rel.OnConflict) ([]interface{}, error)
func (*PrimaryReplica) Instrumentation¶
func (pr *PrimaryReplica) Instrumentation(instrumenter rel.Instrumenter)
func (*PrimaryReplica) Name¶
func (pr *PrimaryReplica) Name() string
func (*PrimaryReplica) Ping¶
func (pr *PrimaryReplica) Ping(ctx context.Context) error
func (*PrimaryReplica) Query¶
func (pr *PrimaryReplica) Query(ctx context.Context, query rel.Query) (rel.Cursor, error)
func (*PrimaryReplica) Rollback¶
func (pr *PrimaryReplica) Rollback(ctx context.Context) error
func (*PrimaryReplica) Update¶
func (pr *PrimaryReplica) Update(ctx context.Context, query rel.Query, primaryField string, mutates map[string]rel.Mutate) (int, error)
func (*PrimaryReplica) WriteAdapter¶
func (pr *PrimaryReplica) WriteAdapter() rel.Adapter
Last update: 2024-08-16