db

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const AuthorNotFoundError = "author not found"
View Source
const PadDoesNotExistError = "pad not found"
View Source
const PadReadOnlyIdNotFoundError = "pad read only id not found"
View Source
const PadRevisionNotFoundError = "pad revision not found"
View Source
const SessionNotFoundError = "session not found"

Variables

This section is empty.

Functions

func CreateRandomPad added in v0.0.2

func CreateRandomPad() db2.PadDB

Types

type AuthorMethods

type AuthorMethods interface {
	GetAuthor(author string) (*db.AuthorDB, error)
	GetAuthorByToken(token string) (*string, error)
	SetAuthorByToken(token string, author string) error
	SaveAuthor(author db.AuthorDB) error
	SaveAuthorName(authorId string, authorName string) error
	SaveAuthorColor(authorId string, authorColor string) error
}

type ChatMethods

type ChatMethods interface {
	RemoveChat(padId string) error
	SaveChatMessage(padId string, head int, authorId *string, timestamp int64, text string) error
	GetChatsOfPad(padId string, start int, end int) (*[]db.ChatMessageDBWithDisplayName, error)
}

type GroupMethods

type GroupMethods interface {
	GetGroup(groupId string) (*string, error)
	SaveGroup(groupId string) error
	RemoveGroup(groupId string) error
}

type MemoryDataStore

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

func NewMemoryDataStore

func NewMemoryDataStore() *MemoryDataStore

func (*MemoryDataStore) Close added in v0.0.2

func (m *MemoryDataStore) Close() error

func (*MemoryDataStore) CreatePad

func (m *MemoryDataStore) CreatePad(padID string, padDB db.PadDB) error

func (*MemoryDataStore) CreatePad2ReadOnly

func (m *MemoryDataStore) CreatePad2ReadOnly(padId string, readonlyId string) error

func (*MemoryDataStore) CreateReadOnly2Pad

func (m *MemoryDataStore) CreateReadOnly2Pad(padId string, readonlyId string) error

func (*MemoryDataStore) DoesPadExist

func (m *MemoryDataStore) DoesPadExist(padID string) (*bool, error)

func (*MemoryDataStore) GetAccessTokenRequestID added in v0.0.2

func (m *MemoryDataStore) GetAccessTokenRequestID(requestID string) (*string, error)

func (*MemoryDataStore) GetAuthor

func (m *MemoryDataStore) GetAuthor(author string) (*db.AuthorDB, error)

func (*MemoryDataStore) GetAuthorByToken

func (m *MemoryDataStore) GetAuthorByToken(token string) (*string, error)

func (*MemoryDataStore) GetChatsOfPad added in v0.0.2

func (m *MemoryDataStore) GetChatsOfPad(padId string, start int, end int) (*[]db.ChatMessageDBWithDisplayName, error)

func (*MemoryDataStore) GetGroup

func (m *MemoryDataStore) GetGroup(groupId string) (*string, error)

func (*MemoryDataStore) GetPad

func (m *MemoryDataStore) GetPad(padID string) (*db.PadDB, error)

func (*MemoryDataStore) GetPadIds

func (m *MemoryDataStore) GetPadIds() (*[]string, error)

func (*MemoryDataStore) GetPadMetaData

func (m *MemoryDataStore) GetPadMetaData(padId string, revNum int) (*db.PadMetaData, error)

func (*MemoryDataStore) GetReadOnly2Pad

func (m *MemoryDataStore) GetReadOnly2Pad(id string) (*string, error)

func (*MemoryDataStore) GetReadonlyPad

func (m *MemoryDataStore) GetReadonlyPad(padId string) (*string, error)

func (*MemoryDataStore) GetRevision

func (m *MemoryDataStore) GetRevision(padId string, rev int) (*db.PadSingleRevision, error)

func (*MemoryDataStore) GetRevisions added in v0.0.2

func (m *MemoryDataStore) GetRevisions(padId string, startRev int, endRev int) (*[]db.PadSingleRevision, error)

func (*MemoryDataStore) GetSessionById

func (m *MemoryDataStore) GetSessionById(sessionID string) (*session2.Session, error)

func (*MemoryDataStore) QueryPad added in v0.0.2

func (m *MemoryDataStore) QueryPad(offset int, limit int, sortBy string, ascending bool, pattern string) (*db.PadDBSearchResult, error)

func (*MemoryDataStore) RemoveChat

func (m *MemoryDataStore) RemoveChat(padId string) error

func (*MemoryDataStore) RemoveGroup added in v0.0.2

func (m *MemoryDataStore) RemoveGroup(groupId string) error

func (*MemoryDataStore) RemovePad

func (m *MemoryDataStore) RemovePad(padID string) error

func (*MemoryDataStore) RemovePad2ReadOnly

func (m *MemoryDataStore) RemovePad2ReadOnly(id string) error

func (*MemoryDataStore) RemoveReadOnly2Pad

func (m *MemoryDataStore) RemoveReadOnly2Pad(id string) error

func (*MemoryDataStore) RemoveRevisionsOfPad

func (m *MemoryDataStore) RemoveRevisionsOfPad(padId string) error

func (*MemoryDataStore) RemoveSessionById

func (m *MemoryDataStore) RemoveSessionById(sessionID string) error

func (*MemoryDataStore) SaveAccessTokenRequestID added in v0.0.2

func (m *MemoryDataStore) SaveAccessTokenRequestID(requestID string, token string) error

func (*MemoryDataStore) SaveAuthor

func (m *MemoryDataStore) SaveAuthor(author db.AuthorDB) error

func (*MemoryDataStore) SaveAuthorColor

func (m *MemoryDataStore) SaveAuthorColor(authorId string, authorColor string) error

func (*MemoryDataStore) SaveAuthorName

func (m *MemoryDataStore) SaveAuthorName(authorId string, authorName string) error

func (*MemoryDataStore) SaveChatHeadOfPad added in v0.0.2

func (m *MemoryDataStore) SaveChatHeadOfPad(padId string, head int) error

func (*MemoryDataStore) SaveChatMessage added in v0.0.2

func (m *MemoryDataStore) SaveChatMessage(padId string, head int, authorId *string, timestamp int64, text string) error

func (*MemoryDataStore) SaveGroup added in v0.0.2

func (m *MemoryDataStore) SaveGroup(groupId string) error

func (*MemoryDataStore) SaveRevision

func (m *MemoryDataStore) SaveRevision(padId string, rev int, changeset string,
	text db.AText, pool db.RevPool, authorId *string, timestamp int64) error

func (*MemoryDataStore) SetAuthorByToken

func (m *MemoryDataStore) SetAuthorByToken(token string, author string) error

func (*MemoryDataStore) SetSessionById

func (m *MemoryDataStore) SetSessionById(sessionID string, session session2.Session) error

type MySQLOptions added in v0.0.2

type MySQLOptions struct {
	Username string
	Password string
	Port     int
	Host     string
	Database string
}

type MysqlDB added in v0.0.2

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

func NewMySQLDB added in v0.0.2

func NewMySQLDB(options MySQLOptions) (*MysqlDB, error)

NewMySQLDB This function creates a new MysqlDB and returns a pointer to it.

func (MysqlDB) Close added in v0.0.2

func (d MysqlDB) Close() error

func (MysqlDB) CreatePad added in v0.0.2

func (d MysqlDB) CreatePad(padID string, padDB db.PadDB) error

func (MysqlDB) CreatePad2ReadOnly added in v0.0.2

func (d MysqlDB) CreatePad2ReadOnly(padId string, readonlyId string) error

func (MysqlDB) CreateReadOnly2Pad added in v0.0.2

func (d MysqlDB) CreateReadOnly2Pad(padId string, readonlyId string) error

func (MysqlDB) DoesPadExist added in v0.0.2

func (d MysqlDB) DoesPadExist(padID string) (*bool, error)

func (MysqlDB) GetAuthor added in v0.0.2

func (d MysqlDB) GetAuthor(author string) (*db.AuthorDB, error)

*

  • Returns the Author Obj of the author
  • @param {String} author The id of the author

func (MysqlDB) GetAuthorByToken added in v0.0.2

func (d MysqlDB) GetAuthorByToken(token string) (*string, error)

func (MysqlDB) GetChatsOfPad added in v0.0.2

func (d MysqlDB) GetChatsOfPad(padId string, start int, end int) (*[]db.ChatMessageDBWithDisplayName, error)

func (MysqlDB) GetGroup added in v0.0.2

func (d MysqlDB) GetGroup(groupId string) (*string, error)

func (MysqlDB) GetPad added in v0.0.2

func (d MysqlDB) GetPad(padID string) (*db.PadDB, error)

func (MysqlDB) GetPadIds added in v0.0.2

func (d MysqlDB) GetPadIds() (*[]string, error)

func (MysqlDB) GetPadMetaData added in v0.0.2

func (d MysqlDB) GetPadMetaData(padId string, revNum int) (*db.PadMetaData, error)

func (MysqlDB) GetReadOnly2Pad added in v0.0.2

func (d MysqlDB) GetReadOnly2Pad(id string) (*string, error)

func (MysqlDB) GetReadonlyPad added in v0.0.2

func (d MysqlDB) GetReadonlyPad(padId string) (*string, error)

func (MysqlDB) GetRevision added in v0.0.2

func (d MysqlDB) GetRevision(padId string, rev int) (*db.PadSingleRevision, error)

func (MysqlDB) GetRevisions added in v0.0.2

func (d MysqlDB) GetRevisions(padId string, startRev int, endRev int) (*[]db.PadSingleRevision, error)

func (MysqlDB) GetSessionById added in v0.0.2

func (d MysqlDB) GetSessionById(sessionID string) (*session2.Session, error)

func (MysqlDB) QueryPad added in v0.0.2

func (d MysqlDB) QueryPad(offset int, limit int, sortBy string, ascending bool, pattern string) (*db.PadDBSearchResult, error)

func (MysqlDB) RemoveChat added in v0.0.2

func (d MysqlDB) RemoveChat(padId string) error

func (MysqlDB) RemoveGroup added in v0.0.2

func (d MysqlDB) RemoveGroup(groupId string) error

func (MysqlDB) RemovePad added in v0.0.2

func (d MysqlDB) RemovePad(padID string) error

func (MysqlDB) RemovePad2ReadOnly added in v0.0.2

func (d MysqlDB) RemovePad2ReadOnly(id string) error

func (MysqlDB) RemoveReadOnly2Pad added in v0.0.2

func (d MysqlDB) RemoveReadOnly2Pad(id string) error

func (MysqlDB) RemoveRevisionsOfPad added in v0.0.2

func (d MysqlDB) RemoveRevisionsOfPad(padId string) error

func (MysqlDB) RemoveSessionById added in v0.0.2

func (d MysqlDB) RemoveSessionById(sid string) error

func (MysqlDB) SaveAuthor added in v0.0.2

func (d MysqlDB) SaveAuthor(author db.AuthorDB) error

func (MysqlDB) SaveAuthorColor added in v0.0.2

func (d MysqlDB) SaveAuthorColor(authorId string, authorColor string) error

func (MysqlDB) SaveAuthorName added in v0.0.2

func (d MysqlDB) SaveAuthorName(authorId string, authorName string) error

func (MysqlDB) SaveChatHeadOfPad added in v0.0.2

func (d MysqlDB) SaveChatHeadOfPad(padId string, head int) error

func (MysqlDB) SaveChatMessage added in v0.0.2

func (d MysqlDB) SaveChatMessage(padId string, head int, authorId *string, timestamp int64, text string) error

func (MysqlDB) SaveGroup added in v0.0.2

func (d MysqlDB) SaveGroup(groupId string) error

func (MysqlDB) SaveRevision added in v0.0.2

func (d MysqlDB) SaveRevision(padId string, rev int, changeset string, text db.AText, pool db.RevPool, authorId *string, timestamp int64) error

func (MysqlDB) SetAuthorByToken added in v0.0.2

func (d MysqlDB) SetAuthorByToken(token, authorId string) error

func (MysqlDB) SetSessionById added in v0.0.2

func (d MysqlDB) SetSessionById(sessionID string, session session2.Session) error

type PadMetaData

type PadMetaData interface {
	GetPadMetaData(padId string, revNum int) (*db.PadMetaData, error)
}

type PadMethods

type PadMethods interface {
	DoesPadExist(padID string) (*bool, error)
	RemovePad(padID string) error
	CreatePad(padID string, padDB db.PadDB) error
	GetPadIds() (*[]string, error)
	SaveRevision(padId string, rev int, changeset string, text db.AText, pool db.RevPool, authorId *string, timestamp int64) error
	GetRevision(padId string, rev int) (*db.PadSingleRevision, error)
	RemoveRevisionsOfPad(padId string) error
	GetRevisions(padId string, startRev int, endRev int) (*[]db.PadSingleRevision, error)
	GetPad(padID string) (*db.PadDB, error)
	GetReadonlyPad(padId string) (*string, error)
	CreatePad2ReadOnly(padId string, readonlyId string) error
	CreateReadOnly2Pad(padId string, readonlyId string) error
	GetReadOnly2Pad(id string) (*string, error)
	RemoveReadOnly2Pad(id string) error
	RemovePad2ReadOnly(id string) error
	SaveChatHeadOfPad(padId string, head int) error
	QueryPad(offset int, limit int, sortBy string, ascending bool, pattern string) (*db.PadDBSearchResult, error)
}

type PostgresDB added in v0.0.2

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

func NewPostgresDB added in v0.0.2

func NewPostgresDB(options PostgresOptions) (*PostgresDB, error)

NewPostgresDB This function creates a new PostgresDB and returns a pointer to it.

func (PostgresDB) Close added in v0.0.2

func (d PostgresDB) Close() error

func (PostgresDB) CreatePad added in v0.0.2

func (d PostgresDB) CreatePad(padID string, padDB db.PadDB) error

func (PostgresDB) CreatePad2ReadOnly added in v0.0.2

func (d PostgresDB) CreatePad2ReadOnly(padId string, readonlyId string) error

func (PostgresDB) CreateReadOnly2Pad added in v0.0.2

func (d PostgresDB) CreateReadOnly2Pad(padId string, readonlyId string) error

func (PostgresDB) DoesPadExist added in v0.0.2

func (d PostgresDB) DoesPadExist(padID string) (*bool, error)

func (PostgresDB) GetAuthor added in v0.0.2

func (d PostgresDB) GetAuthor(author string) (*db.AuthorDB, error)

*

  • Returns the Author Obj of the author
  • @param {String} author The id of the author

func (PostgresDB) GetAuthorByToken added in v0.0.2

func (d PostgresDB) GetAuthorByToken(token string) (*string, error)

func (PostgresDB) GetChatsOfPad added in v0.0.2

func (d PostgresDB) GetChatsOfPad(padId string, start int, end int) (*[]db.ChatMessageDBWithDisplayName, error)

func (PostgresDB) GetGroup added in v0.0.2

func (d PostgresDB) GetGroup(groupId string) (*string, error)

func (PostgresDB) GetPad added in v0.0.2

func (d PostgresDB) GetPad(padID string) (*db.PadDB, error)

func (PostgresDB) GetPadIds added in v0.0.2

func (d PostgresDB) GetPadIds() (*[]string, error)

func (PostgresDB) GetPadMetaData added in v0.0.2

func (d PostgresDB) GetPadMetaData(padId string, revNum int) (*db.PadMetaData, error)

func (PostgresDB) GetReadOnly2Pad added in v0.0.2

func (d PostgresDB) GetReadOnly2Pad(id string) (*string, error)

func (PostgresDB) GetReadonlyPad added in v0.0.2

func (d PostgresDB) GetReadonlyPad(padId string) (*string, error)

func (PostgresDB) GetRevision added in v0.0.2

func (d PostgresDB) GetRevision(padId string, rev int) (*db.PadSingleRevision, error)

func (PostgresDB) GetRevisions added in v0.0.2

func (d PostgresDB) GetRevisions(padId string, startRev int, endRev int) (*[]db.PadSingleRevision, error)

func (PostgresDB) GetSessionById added in v0.0.2

func (d PostgresDB) GetSessionById(sessionID string) (*session2.Session, error)

func (PostgresDB) QueryPad added in v0.0.2

func (d PostgresDB) QueryPad(offset int, limit int, sortBy string, ascending bool, pattern string) (*db.PadDBSearchResult, error)

func (PostgresDB) RemoveChat added in v0.0.2

func (d PostgresDB) RemoveChat(padId string) error

func (PostgresDB) RemoveGroup added in v0.0.2

func (d PostgresDB) RemoveGroup(groupId string) error

func (PostgresDB) RemovePad added in v0.0.2

func (d PostgresDB) RemovePad(padID string) error

func (PostgresDB) RemovePad2ReadOnly added in v0.0.2

func (d PostgresDB) RemovePad2ReadOnly(id string) error

func (PostgresDB) RemoveReadOnly2Pad added in v0.0.2

func (d PostgresDB) RemoveReadOnly2Pad(id string) error

func (PostgresDB) RemoveRevisionsOfPad added in v0.0.2

func (d PostgresDB) RemoveRevisionsOfPad(padId string) error

func (PostgresDB) RemoveSessionById added in v0.0.2

func (d PostgresDB) RemoveSessionById(sid string) error

func (PostgresDB) SaveAuthor added in v0.0.2

func (d PostgresDB) SaveAuthor(author db.AuthorDB) error

func (PostgresDB) SaveAuthorColor added in v0.0.2

func (d PostgresDB) SaveAuthorColor(authorId string, authorColor string) error

func (PostgresDB) SaveAuthorName added in v0.0.2

func (d PostgresDB) SaveAuthorName(authorId string, authorName string) error

func (PostgresDB) SaveChatHeadOfPad added in v0.0.2

func (d PostgresDB) SaveChatHeadOfPad(padId string, head int) error

func (PostgresDB) SaveChatMessage added in v0.0.2

func (d PostgresDB) SaveChatMessage(padId string, head int, authorId *string, timestamp int64, text string) error

func (PostgresDB) SaveGroup added in v0.0.2

func (d PostgresDB) SaveGroup(groupId string) error

func (PostgresDB) SaveRevision added in v0.0.2

func (d PostgresDB) SaveRevision(padId string, rev int, changeset string, text db.AText, pool db.RevPool, authorId *string, timestamp int64) error

func (PostgresDB) SetAuthorByToken added in v0.0.2

func (d PostgresDB) SetAuthorByToken(token, authorId string) error

func (PostgresDB) SetSessionById added in v0.0.2

func (d PostgresDB) SetSessionById(sessionID string, session session2.Session) error

type PostgresOptions added in v0.0.2

type PostgresOptions struct {
	Username string
	Password string
	Port     int
	Host     string
	Database string
}

type SQLiteDB

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

func NewSQLiteDB added in v0.0.2

func NewSQLiteDB(path string) (*SQLiteDB, error)

NewSQLiteDB This function creates a new SQLiteDB and returns a pointer to it.

func (SQLiteDB) Close added in v0.0.2

func (d SQLiteDB) Close() error

func (SQLiteDB) CreatePad

func (d SQLiteDB) CreatePad(padID string, padDB db.PadDB) error

func (SQLiteDB) CreatePad2ReadOnly

func (d SQLiteDB) CreatePad2ReadOnly(padId string, readonlyId string) error

func (SQLiteDB) CreateReadOnly2Pad

func (d SQLiteDB) CreateReadOnly2Pad(padId string, readonlyId string) error

func (SQLiteDB) DoesPadExist

func (d SQLiteDB) DoesPadExist(padID string) (*bool, error)

func (SQLiteDB) GetAuthor

func (d SQLiteDB) GetAuthor(author string) (*db.AuthorDB, error)

*

  • Returns the Author Obj of the author
  • @param {String} author The id of the author

func (SQLiteDB) GetAuthorByToken

func (d SQLiteDB) GetAuthorByToken(token string) (*string, error)

func (SQLiteDB) GetChatsOfPad added in v0.0.2

func (d SQLiteDB) GetChatsOfPad(padId string, start int, end int) (*[]db.ChatMessageDBWithDisplayName, error)

func (SQLiteDB) GetGroup

func (d SQLiteDB) GetGroup(groupId string) (*string, error)

func (SQLiteDB) GetPad

func (d SQLiteDB) GetPad(padID string) (*db.PadDB, error)

func (SQLiteDB) GetPadIds

func (d SQLiteDB) GetPadIds() (*[]string, error)

func (SQLiteDB) GetPadMetaData

func (d SQLiteDB) GetPadMetaData(padId string, revNum int) (*db.PadMetaData, error)

func (SQLiteDB) GetReadOnly2Pad

func (d SQLiteDB) GetReadOnly2Pad(id string) (*string, error)

func (SQLiteDB) GetReadonlyPad

func (d SQLiteDB) GetReadonlyPad(padId string) (*string, error)

func (SQLiteDB) GetRevision

func (d SQLiteDB) GetRevision(padId string, rev int) (*db.PadSingleRevision, error)

func (SQLiteDB) GetRevisions added in v0.0.2

func (d SQLiteDB) GetRevisions(padId string, startRev int, endRev int) (*[]db.PadSingleRevision, error)

func (SQLiteDB) GetSessionById

func (d SQLiteDB) GetSessionById(sessionID string) (*session2.Session, error)

func (SQLiteDB) QueryPad added in v0.0.2

func (d SQLiteDB) QueryPad(offset int, limit int, sortBy string, ascending bool, pattern string) (*db.PadDBSearchResult, error)

func (SQLiteDB) RemoveChat

func (d SQLiteDB) RemoveChat(padId string) error

func (SQLiteDB) RemoveGroup added in v0.0.2

func (d SQLiteDB) RemoveGroup(groupId string) error

func (SQLiteDB) RemovePad

func (d SQLiteDB) RemovePad(padID string) error

func (SQLiteDB) RemovePad2ReadOnly

func (d SQLiteDB) RemovePad2ReadOnly(id string) error

func (SQLiteDB) RemoveReadOnly2Pad

func (d SQLiteDB) RemoveReadOnly2Pad(id string) error

func (SQLiteDB) RemoveRevisionsOfPad

func (d SQLiteDB) RemoveRevisionsOfPad(padId string) error

func (SQLiteDB) RemoveSessionById

func (d SQLiteDB) RemoveSessionById(sid string) error

func (SQLiteDB) SaveAccessToken added in v0.0.2

func (d SQLiteDB) SaveAccessToken(token string, data fosite.Requester) error

func (SQLiteDB) SaveAuthor

func (d SQLiteDB) SaveAuthor(author db.AuthorDB) error

func (SQLiteDB) SaveAuthorColor

func (d SQLiteDB) SaveAuthorColor(authorId string, authorColor string) error

func (SQLiteDB) SaveAuthorName

func (d SQLiteDB) SaveAuthorName(authorId string, authorName string) error

func (SQLiteDB) SaveChatHeadOfPad added in v0.0.2

func (d SQLiteDB) SaveChatHeadOfPad(padId string, head int) error

func (SQLiteDB) SaveChatMessage added in v0.0.2

func (d SQLiteDB) SaveChatMessage(padId string, head int, authorId *string, timestamp int64, text string) error

func (SQLiteDB) SaveGroup added in v0.0.2

func (d SQLiteDB) SaveGroup(groupId string) error

func (SQLiteDB) SaveRevision

func (d SQLiteDB) SaveRevision(padId string, rev int, changeset string, text db.AText, pool db.RevPool, authorId *string, timestamp int64) error

func (SQLiteDB) SetAuthorByToken

func (d SQLiteDB) SetAuthorByToken(token, authorId string) error

func (SQLiteDB) SetSessionById

func (d SQLiteDB) SetSessionById(sessionID string, session session2.Session) error

type SessionMethods

type SessionMethods interface {
	GetSessionById(sessionID string) (*session2.Session, error)
	SetSessionById(sessionID string, session session2.Session) error
	RemoveSessionById(sessionID string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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