replicache

package module
v0.0.0-...-5a6603d Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientInfo

type ClientInfo struct {
	Auth          string
	ClientGroupID string
	ProfileID     string
	SchemaVersion string
}

type Handler

type Handler interface {
	PushHandler
	PullHandler
}

type Mutation

type Mutation struct {
	ClientID string          `json:"clientID"`
	ID       int             `json:"id"`
	Name     string          `json:"name"`
	Args     json.RawMessage `json:"args"`

	// DOMHighResTimeStamp (not used by the protocol)
	Timestamp float64 `json:"timestamp"`
}

type Option

type Option func(r *Replicache) error

type PullHandler

type PullHandler interface {
	HandlePull(ctx context.Context, pr PullRequest) (any, error)
}

type PullRequest

type PullRequest struct {
	ClientInfo
	Tx *sql.Tx
}

type PushHandler

type PushHandler interface {
	HandlePush(ctx context.Context, pr PushRequest) error
}

type PushRequest

type PushRequest struct {
	ClientInfo
	Mutations []Mutation
	Tx        *sql.Tx
}

type Replicache

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

func NewReplicache

func NewReplicache(db *sql.DB, handler Handler, options ...Option) (*Replicache, error)

func (*Replicache) PushHandler

func (rep *Replicache) PushHandler() http.Handler

Jump to

Keyboard shortcuts

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