Documentation
¶
Index ¶
- Constants
- func RunFromCLI(logger *zap.SugaredLogger, args []string)
- type Author
- type Author2Sessions
- type ChatMessage
- type Database
- type DriverType
- type Group
- type Group2Sessions
- type Migrator
- type Pad
- type Pad2Readonly
- type PadRevision
- type Readonly2Pad
- type SQLDatabase
- func NewDB(dsn string, dbType string) (*SQLDatabase, error)
- func NewMySQLDatabase(dsn string) (*SQLDatabase, error)
- func NewPostgresDatabase(dsn string) (*SQLDatabase, error)
- func NewSQLDatabase(db *sql.DB, driver DriverType) (*SQLDatabase, error)
- func NewSQLiteDatabase(dsn string) (*SQLDatabase, error)
- func (s *SQLDatabase) Close() error
- func (s *SQLDatabase) GetNextAuthor2Sessions(lastAuthorId string, limit int) ([]Author2Sessions, error)
- func (s *SQLDatabase) GetNextAuthors(lastAuthorId string, limit int) ([]Author, error)
- func (s *SQLDatabase) GetNextGroup2Sessions(lastGroupId string, limit int) ([]Group2Sessions, error)
- func (s *SQLDatabase) GetNextGroups(lastGroupId string, limit int) ([]Group, error)
- func (s *SQLDatabase) GetNextPad2Readonly(lastPadId string, limit int) ([]Pad2Readonly, error)
- func (s *SQLDatabase) GetNextPads(lastPadId string, limit int) ([]Pad, error)
- func (s *SQLDatabase) GetNextReadonly2Pad(lastReadonlyId string, limit int) ([]Readonly2Pad, error)
- func (s *SQLDatabase) GetNextSessions(lastSessionId string, limit int) ([]Session, error)
- func (s *SQLDatabase) GetNextToken2Author(lastToken string, limit int) ([]Token2Author, error)
- func (s *SQLDatabase) GetPadChatMessages(padId string, lastChatNum int, limit int) ([]ChatMessage, error)
- func (s *SQLDatabase) GetPadRevisions(padId string, lastRev int, limit int) ([]PadRevision, error)
- type Session
- type Token2Author
Constants ¶
View Source
const EpDbPassword = "EP_DB_PASSWORD" // environment variable for the database password
Variables ¶
This section is empty.
Functions ¶
func RunFromCLI ¶
func RunFromCLI(logger *zap.SugaredLogger, args []string)
Types ¶
type Author2Sessions ¶
type ChatMessage ¶
type Database ¶
type Database interface {
// Pads
GetNextPads(lastPadId string, limit int) ([]Pad, error)
GetPadRevisions(padId string, lastRev int, limit int) ([]PadRevision, error)
// Authors
GetNextAuthors(lastAuthorId string, limit int) ([]Author, error)
// Readonly mappings
GetNextReadonly2Pad(lastReadonlyId string, limit int) ([]Readonly2Pad, error)
GetNextPad2Readonly(lastPadId string, limit int) ([]Pad2Readonly, error)
// Token to Author mappings
GetNextToken2Author(lastToken string, limit int) ([]Token2Author, error)
// Chat messages
GetPadChatMessages(padId string, lastChatNum int, limit int) ([]ChatMessage, error)
// Groups
GetNextGroups(lastGroupId string, limit int) ([]Group, error)
GetNextGroup2Sessions(lastGroupId string, limit int) ([]Group2Sessions, error)
GetNextAuthor2Sessions(lastAuthorId string, limit int) ([]Author2Sessions, error)
GetNextSessions(lastSessionId string, limit int) ([]Session, error)
// Utility
Close() error
}
type DriverType ¶
type DriverType int
const ( DriverSQLite DriverType = iota DriverPostgres DriverMySQL )
type Group2Sessions ¶
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
func NewMigrator ¶
func NewMigrator(oldEtherpadDB *SQLDatabase, newDataStore db.DataStore, logger *zap.SugaredLogger) *Migrator
func (*Migrator) MigrateAuthors ¶
func (*Migrator) MigratePad2Readonly ¶
func (*Migrator) MigratePadChats ¶
func (*Migrator) MigratePads ¶
func (*Migrator) MigrateRevisions ¶
func (*Migrator) MigrateToken2Author ¶
type Pad ¶
type Pad struct {
PadId string `json:"-"`
AText struct {
Text string `json:"text"`
Attribs string `json:"attribs"`
} `json:"atext"`
Pool struct {
NumToAttrib map[string][]string `json:"numToAttrib"`
NextNum int `json:"nextNum"`
} `json:"pool"`
Head int `json:"head"`
ChatHead int `json:"chatHead"`
PublicStatus bool `json:"publicStatus"`
SavedRevisions []struct {
RevNum int `json:"revNum"`
Timestamp int64 `json:"timestamp"`
SavedById string `json:"savedById"`
Label string `json:"label"`
Id string `json:"id"`
} `json:"savedRevisions"`
}
type Pad2Readonly ¶
type PadRevision ¶
type PadRevision struct {
PadRevisionId string `json:"-"`
RevNum int `json:"-"`
Changeset string `json:"changeset"`
Meta struct {
Author string `json:"author"`
Timestamp int64 `json:"timestamp"`
Pool struct {
NumToAttrib map[string][]string `json:"numToAttrib"`
AttribToNum map[string]int `json:"attribToNum"`
NextNum int `json:"nextNum"`
} `json:"pool"`
Atext struct {
Text string `json:"text"`
Attribs string `json:"attribs"`
} `json:"atext"`
} `json:"meta"`
}
type Readonly2Pad ¶
type SQLDatabase ¶
type SQLDatabase struct {
// contains filtered or unexported fields
}
SQLDatabase implements the Database interface for SQL-based Etherpad stores
func NewMySQLDatabase ¶
func NewMySQLDatabase(dsn string) (*SQLDatabase, error)
NewMySQLDatabase creates a MySQL-backed database
func NewPostgresDatabase ¶
func NewPostgresDatabase(dsn string) (*SQLDatabase, error)
NewPostgresDatabase creates a PostgreSQL-backed database
func NewSQLDatabase ¶
func NewSQLDatabase(db *sql.DB, driver DriverType) (*SQLDatabase, error)
NewSQLDatabase creates a new SQLDatabase with the appropriate settings
func NewSQLiteDatabase ¶
func NewSQLiteDatabase(dsn string) (*SQLDatabase, error)
func (*SQLDatabase) Close ¶
func (s *SQLDatabase) Close() error
func (*SQLDatabase) GetNextAuthor2Sessions ¶
func (s *SQLDatabase) GetNextAuthor2Sessions( lastAuthorId string, limit int, ) ([]Author2Sessions, error)
func (*SQLDatabase) GetNextAuthors ¶
func (s *SQLDatabase) GetNextAuthors(lastAuthorId string, limit int) ([]Author, error)
func (*SQLDatabase) GetNextGroup2Sessions ¶
func (s *SQLDatabase) GetNextGroup2Sessions( lastGroupId string, limit int, ) ([]Group2Sessions, error)
func (*SQLDatabase) GetNextGroups ¶
func (s *SQLDatabase) GetNextGroups(lastGroupId string, limit int) ([]Group, error)
func (*SQLDatabase) GetNextPad2Readonly ¶
func (s *SQLDatabase) GetNextPad2Readonly(lastPadId string, limit int) ([]Pad2Readonly, error)
func (*SQLDatabase) GetNextPads ¶
func (s *SQLDatabase) GetNextPads(lastPadId string, limit int) ([]Pad, error)
func (*SQLDatabase) GetNextReadonly2Pad ¶
func (s *SQLDatabase) GetNextReadonly2Pad( lastReadonlyId string, limit int, ) ([]Readonly2Pad, error)
func (*SQLDatabase) GetNextSessions ¶
func (s *SQLDatabase) GetNextSessions(lastSessionId string, limit int) ([]Session, error)
func (*SQLDatabase) GetNextToken2Author ¶
func (s *SQLDatabase) GetNextToken2Author(lastToken string, limit int) ([]Token2Author, error)
func (*SQLDatabase) GetPadChatMessages ¶
func (s *SQLDatabase) GetPadChatMessages( padId string, lastChatNum int, limit int, ) ([]ChatMessage, error)
func (*SQLDatabase) GetPadRevisions ¶
func (s *SQLDatabase) GetPadRevisions( padId string, lastRev int, limit int, ) ([]PadRevision, error)
type Token2Author ¶
Click to show internal directories.
Click to hide internal directories.