Documentation ¶
Index ¶
- Constants
- Variables
- func ErrorData(errObj any) map[string]any
- func ErrorJSON(err any) string
- func ErrorJSONBytes(err any) []byte
- func ErrorType(errObj any) string
- func MemoryStorage(id, content string) hist.DocStorage
- type LeisureContext
- type LeisureError
- type LeisureService
- type LeisureSession
- type Sha
Constants ¶
View Source
const ( VERSION = "/v1" DOC_CREATE = VERSION + "/doc/create/" DOC_GET = VERSION + "/doc/get/" DOC_LIST = VERSION + "/doc/list" SESSION_CLOSE = VERSION + "/session/close" SESSION_CONNECT = VERSION + "/session/connect/" SESSION_CREATE = VERSION + "/session/create/" SESSION_LIST = VERSION + "/session/list" SESSION_DOCUMENT = VERSION + "/session/document" SESSION_EDIT = VERSION + "/session/edit" SESSION_UPDATE = VERSION + "/session/update" SESSION_GET = VERSION + "/session/get/" SESSION_SET = VERSION + "/session/set/" SESSION_REMOVE = VERSION + "/session/remove/" ORG_PARSE = VERSION + "/org/parse" )
View Source
const (
DEFAULT_COOKIE_TIMEOUT = 5 * time.Minute
)
View Source
const JSON_TAG = `(^|,)json:"([^"]+)"`
View Source
const UPDATE_TIME = 2 * time.Minute
Variables ¶
View Source
var ErrCommandFormat = NewLeisureError("badCommandFormat")
View Source
var ErrDataMismatch = NewLeisureError("dataMismatch")
View Source
var ErrDataMissing = NewLeisureError("dataMissing")
View Source
var ErrDocumentAliasExists = NewLeisureError("documentAliasExists")
View Source
var ErrDocumentExists = NewLeisureError("documentExists")
View Source
var ErrDuplicateConnection = NewLeisureError("duplicateConnection")
View Source
var ErrDuplicateSession = NewLeisureError("duplicateSession")
View Source
var ErrExpiredSession = NewLeisureError("expiredSession")
View Source
var ErrInternalError = NewLeisureError("internalError")
View Source
var ErrUnknown = NewLeisureError("unknownError")
View Source
var ErrUnknownDocument = NewLeisureError("unknownDocument")
View Source
var ErrUnknownSession = NewLeisureError("unknownSession")
Functions ¶
func ErrorJSONBytes ¶ added in v0.0.1
func MemoryStorage ¶
func MemoryStorage(id, content string) hist.DocStorage
Types ¶
type LeisureContext ¶ added in v0.0.1
type LeisureContext struct { *LeisureService // contains filtered or unexported fields }
type LeisureError ¶ added in v0.0.1
type LeisureError struct { Type string Data map[string]any // contains filtered or unexported fields }
func NewLeisureError ¶ added in v0.0.1
func NewLeisureError(errorType string, values ...any) LeisureError
func (LeisureError) Error ¶ added in v0.0.1
func (err LeisureError) Error() string
func (LeisureError) Unwrap ¶ added in v0.0.1
func (err LeisureError) Unwrap() error
type LeisureService ¶
type LeisureService struct {
// contains filtered or unexported fields
}
func Initialize ¶
func Initialize(id string, mux *http.ServeMux, storageFactory func(string, string) hist.DocStorage) *LeisureService
func NewWebService ¶
func NewWebService(id string, storageFactory func(string, string) hist.DocStorage) *LeisureService
func (*LeisureService) SetVerbose ¶ added in v0.0.1
func (sv *LeisureService) SetVerbose(n int)
type LeisureSession ¶
type LeisureSession struct { *history.History Peer string SessionId string PendingOps []doc.Replacement Follow string // track a sessionId when making new commits // contains filtered or unexported fields }
func (*LeisureSession) Commit ¶ added in v0.0.8
func (s *LeisureSession) Commit(selOff int, selLen int) ([]doc.Replacement, int, int)
commit pending ops into an opBlock, get its document, and return the replacements these will unwind the current document to the common ancestor and replay to the current version
func (*LeisureSession) Replace ¶ added in v0.0.8
func (s *LeisureSession) Replace(offset int, length int, text string)
add a replacement to pendingOps
func (*LeisureSession) ReplaceAll ¶ added in v0.0.8
func (s *LeisureSession) ReplaceAll(replacements []doc.Replacement)
add a replacement to pendingOps
Click to show internal directories.
Click to hide internal directories.