db

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: Apache-2.0 Imports: 21 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

func RandomString added in v0.0.4

func RandomString(length int) string

func ReadToAuthorDB added in v0.0.4

func ReadToAuthorDB(reader Reader) (*db.AuthorDB, error)

func ReadToPadDB added in v0.0.4

func ReadToPadDB(reader Reader) (*db.PadDB, error)

Types

type AuthorMethods

type AuthorMethods interface {
	GetAuthor(author string) (*db.AuthorDB, error)
	GetPadIdsOfAuthor(authorId string) (*[]string, 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
	GetAuthors(ids []string) (*[]db.AuthorDB, 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)
	GetAuthorIdsOfPadChats(id string) (*[]string, 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) CreateAccessToken added in v0.5.0

func (m *MemoryDataStore) CreateAccessToken(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error

func (*MemoryDataStore) CreateAuthCode added in v0.5.0

func (m *MemoryDataStore) CreateAuthCode(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error

func (*MemoryDataStore) CreateOIDCSession added in v0.5.0

func (m *MemoryDataStore) CreateOIDCSession(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error

func (*MemoryDataStore) CreatePKCE added in v0.5.0

func (m *MemoryDataStore) CreatePKCE(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error

func (*MemoryDataStore) CreatePad

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

func (*MemoryDataStore) CreatePad2ReadOnly deprecated

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

Deprecated: Use SetReadOnlyId instead

func (*MemoryDataStore) CreateReadOnly2Pad deprecated

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

Deprecated: Use SetReadOnlyId instead - readonly2pad is derived from pad store

func (*MemoryDataStore) CreateRefreshToken added in v0.5.0

func (m *MemoryDataStore) CreateRefreshToken(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, active bool, accessTokenSignature string, requestedAt, expiresAt time.Time) error

func (*MemoryDataStore) DeleteAccessToken added in v0.5.0

func (m *MemoryDataStore) DeleteAccessToken(signature string) error

func (*MemoryDataStore) DeleteAccessTokensByRequestID added in v0.5.0

func (m *MemoryDataStore) DeleteAccessTokensByRequestID(requestID string) error

func (*MemoryDataStore) DeleteOIDCSession added in v0.5.0

func (m *MemoryDataStore) DeleteOIDCSession(signature string) error

func (*MemoryDataStore) DeleteOIDCStorageValue added in v0.5.0

func (m *MemoryDataStore) DeleteOIDCStorageValue(key string) error

func (*MemoryDataStore) DeletePKCE added in v0.5.0

func (m *MemoryDataStore) DeletePKCE(signature string) error

func (*MemoryDataStore) DeleteRefreshToken added in v0.5.0

func (m *MemoryDataStore) DeleteRefreshToken(signature string) error

func (*MemoryDataStore) DoesPadExist

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

func (*MemoryDataStore) GetAccessToken added in v0.5.0

func (m *MemoryDataStore) GetAccessToken(signature string) (*OAuthTokenRow, error)

func (*MemoryDataStore) GetAccessTokenRequestID added in v0.0.2

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

func (*MemoryDataStore) GetAuthCode added in v0.5.0

func (m *MemoryDataStore) GetAuthCode(signature string) (*OAuthTokenRow, error)

func (*MemoryDataStore) GetAuthor

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

func (*MemoryDataStore) GetAuthorByToken

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

func (*MemoryDataStore) GetAuthorIdsOfPadChats added in v0.0.4

func (m *MemoryDataStore) GetAuthorIdsOfPadChats(id string) (*[]string, error)

func (*MemoryDataStore) GetAuthors added in v0.0.4

func (m *MemoryDataStore) GetAuthors(ids []string) (*[]db.AuthorDB, 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) GetOIDCSession added in v0.5.0

func (m *MemoryDataStore) GetOIDCSession(signature string) (*OAuthTokenRow, error)

func (*MemoryDataStore) GetOIDCStorageValue added in v0.5.0

func (m *MemoryDataStore) GetOIDCStorageValue(key string) (*string, error)

func (*MemoryDataStore) GetPKCE added in v0.5.0

func (m *MemoryDataStore) GetPKCE(signature string) (*OAuthTokenRow, error)

func (*MemoryDataStore) GetPad

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

func (*MemoryDataStore) GetPadByReadOnlyId added in v0.0.4

func (m *MemoryDataStore) GetPadByReadOnlyId(readonlyId string) (*string, error)

func (*MemoryDataStore) GetPadIds

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

func (*MemoryDataStore) GetPadIdsOfAuthor added in v0.0.4

func (m *MemoryDataStore) GetPadIdsOfAuthor(authorId string) (*[]string, error)

func (*MemoryDataStore) GetReadOnly2Pad deprecated

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

Deprecated: Use GetPadByReadOnlyId instead

func (*MemoryDataStore) GetReadonlyPad

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

func (*MemoryDataStore) GetRefreshToken added in v0.5.0

func (m *MemoryDataStore) GetRefreshToken(signature string) (*OAuthRefreshTokenRow, 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) GetServerVersion added in v0.0.5

func (m *MemoryDataStore) GetServerVersion() (*db.ServerVersion, error)

func (*MemoryDataStore) GetSessionById

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

func (*MemoryDataStore) InvalidateAuthCode added in v0.5.0

func (m *MemoryDataStore) InvalidateAuthCode(signature string) error

func (*MemoryDataStore) Ping added in v0.0.5

func (m *MemoryDataStore) Ping() 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 deprecated

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

Deprecated: Handled by RemovePad

func (*MemoryDataStore) RemoveReadOnly2Pad deprecated

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

Deprecated: Handled by RemovePad

func (*MemoryDataStore) RemoveRevisionsOfPad

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

func (*MemoryDataStore) RemoveSessionById

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

func (*MemoryDataStore) RevokeRefreshToken added in v0.5.0

func (m *MemoryDataStore) RevokeRefreshToken(signature string) error

func (*MemoryDataStore) RevokeRefreshTokensByRequestID added in v0.5.0

func (m *MemoryDataStore) RevokeRefreshTokensByRequestID(requestID 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) SaveServerVersion added in v0.0.5

func (m *MemoryDataStore) SaveServerVersion(version string) error

func (*MemoryDataStore) SetAuthorByToken

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

func (*MemoryDataStore) SetOIDCStorageValue added in v0.5.0

func (m *MemoryDataStore) SetOIDCStorageValue(key string, payload string) error

func (*MemoryDataStore) SetReadOnlyId added in v0.0.4

func (m *MemoryDataStore) SetReadOnlyId(padId string, readonlyId 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)

func (MysqlDB) Close added in v0.0.2

func (d MysqlDB) Close() error

func (MysqlDB) CreateAccessToken added in v0.5.0

func (d MysqlDB) CreateAccessToken(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error

func (MysqlDB) CreateAuthCode added in v0.5.0

func (d MysqlDB) CreateAuthCode(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error

func (MysqlDB) CreateOIDCSession added in v0.5.0

func (d MysqlDB) CreateOIDCSession(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error

func (MysqlDB) CreatePKCE added in v0.5.0

func (d MysqlDB) CreatePKCE(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error

func (MysqlDB) CreatePad added in v0.0.2

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

func (MysqlDB) CreateRefreshToken added in v0.5.0

func (d MysqlDB) CreateRefreshToken(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, active bool, accessTokenSignature string, requestedAt, expiresAt time.Time) error

func (MysqlDB) DeleteAccessToken added in v0.5.0

func (d MysqlDB) DeleteAccessToken(signature string) error

func (MysqlDB) DeleteAccessTokensByRequestID added in v0.5.0

func (d MysqlDB) DeleteAccessTokensByRequestID(requestID string) error

func (MysqlDB) DeleteOIDCSession added in v0.5.0

func (d MysqlDB) DeleteOIDCSession(signature string) error

func (MysqlDB) DeleteOIDCStorageValue added in v0.5.0

func (d MysqlDB) DeleteOIDCStorageValue(key string) error

func (MysqlDB) DeletePKCE added in v0.5.0

func (d MysqlDB) DeletePKCE(signature string) error

func (MysqlDB) DeleteRefreshToken added in v0.5.0

func (d MysqlDB) DeleteRefreshToken(signature string) error

func (MysqlDB) DoesPadExist added in v0.0.2

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

func (MysqlDB) GetAccessToken added in v0.5.0

func (d MysqlDB) GetAccessToken(signature string) (*OAuthTokenRow, error)

func (MysqlDB) GetAuthCode added in v0.5.0

func (d MysqlDB) GetAuthCode(signature string) (*OAuthTokenRow, error)

func (MysqlDB) GetAuthor added in v0.0.2

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

func (MysqlDB) GetAuthorByToken added in v0.0.2

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

func (MysqlDB) GetAuthorIdsOfPadChats added in v0.0.4

func (d MysqlDB) GetAuthorIdsOfPadChats(id string) (*[]string, error)

func (MysqlDB) GetAuthors added in v0.0.4

func (d MysqlDB) GetAuthors(ids []string) (*[]db.AuthorDB, 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) GetOIDCSession added in v0.5.0

func (d MysqlDB) GetOIDCSession(signature string) (*OAuthTokenRow, error)

func (MysqlDB) GetOIDCStorageValue added in v0.5.0

func (d MysqlDB) GetOIDCStorageValue(key string) (*string, error)

func (MysqlDB) GetPKCE added in v0.5.0

func (d MysqlDB) GetPKCE(signature string) (*OAuthTokenRow, error)

func (MysqlDB) GetPad added in v0.0.2

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

func (MysqlDB) GetPadByReadOnlyId added in v0.0.4

func (d MysqlDB) GetPadByReadOnlyId(readonlyId string) (*string, error)

func (MysqlDB) GetPadIds added in v0.0.2

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

func (MysqlDB) GetPadIdsOfAuthor added in v0.0.4

func (d MysqlDB) GetPadIdsOfAuthor(authorId string) (*[]string, error)

func (MysqlDB) GetReadonlyPad added in v0.0.2

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

func (MysqlDB) GetRefreshToken added in v0.5.0

func (d MysqlDB) GetRefreshToken(signature string) (*OAuthRefreshTokenRow, 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) GetServerVersion added in v0.0.5

func (d MysqlDB) GetServerVersion() (*db.ServerVersion, error)

func (MysqlDB) GetSessionById added in v0.0.2

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

func (MysqlDB) InvalidateAuthCode added in v0.5.0

func (d MysqlDB) InvalidateAuthCode(signature string) error

func (MysqlDB) Ping added in v0.0.5

func (d MysqlDB) Ping() 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) 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) RevokeRefreshToken added in v0.5.0

func (d MysqlDB) RevokeRefreshToken(signature string) error

func (MysqlDB) RevokeRefreshTokensByRequestID added in v0.5.0

func (d MysqlDB) RevokeRefreshTokensByRequestID(requestID 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) SaveServerVersion added in v0.0.5

func (d MysqlDB) SaveServerVersion(version string) error

func (MysqlDB) SetAuthorByToken added in v0.0.2

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

func (MysqlDB) SetOIDCStorageValue added in v0.5.0

func (d MysqlDB) SetOIDCStorageValue(key string, payload string) error

func (MysqlDB) SetReadOnlyId added in v0.0.4

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

func (MysqlDB) SetSessionById added in v0.0.2

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

type OAuthRefreshTokenRow added in v0.5.0

type OAuthRefreshTokenRow struct {
	OAuthTokenRow
	AccessTokenSignature string
}

type OAuthTokenRow added in v0.5.0

type OAuthTokenRow struct {
	Signature     string
	ClientID      string
	RequestID     string
	Scopes        string
	GrantedScopes string
	FormData      string
	SessionData   string
	Active        bool
	RequestedAt   time.Time
	ExpiresAt     time.Time
}

type OIDCMethods added in v0.5.0

type OIDCMethods interface {
	// Existing key-value methods (keep for signing key storage)
	GetOIDCStorageValue(key string) (*string, error)
	SetOIDCStorageValue(key string, payload string) error
	DeleteOIDCStorageValue(key string) error

	// Access tokens
	CreateAccessToken(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error
	GetAccessToken(signature string) (*OAuthTokenRow, error)
	DeleteAccessToken(signature string) error
	DeleteAccessTokensByRequestID(requestID string) error

	// Refresh tokens
	CreateRefreshToken(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, active bool, accessTokenSignature string, requestedAt, expiresAt time.Time) error
	GetRefreshToken(signature string) (*OAuthRefreshTokenRow, error)
	DeleteRefreshToken(signature string) error
	RevokeRefreshToken(signature string) error
	RevokeRefreshTokensByRequestID(requestID string) error

	// Auth codes
	CreateAuthCode(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error
	GetAuthCode(signature string) (*OAuthTokenRow, error)
	InvalidateAuthCode(signature string) error

	// PKCE
	CreatePKCE(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error
	GetPKCE(signature string) (*OAuthTokenRow, error)
	DeletePKCE(signature string) error

	// OIDC Sessions
	CreateOIDCSession(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error
	GetOIDCSession(signature string) (*OAuthTokenRow, error)
	DeleteOIDCSession(signature string) 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)
	SetReadOnlyId(padId string, readOnlyId string) error
	GetPadByReadOnlyId(id string) (*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)

func (PostgresDB) Close added in v0.0.2

func (d PostgresDB) Close() error

func (PostgresDB) CreateAccessToken added in v0.5.0

func (d PostgresDB) CreateAccessToken(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error

func (PostgresDB) CreateAuthCode added in v0.5.0

func (d PostgresDB) CreateAuthCode(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error

func (PostgresDB) CreateOIDCSession added in v0.5.0

func (d PostgresDB) CreateOIDCSession(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error

func (PostgresDB) CreatePKCE added in v0.5.0

func (d PostgresDB) CreatePKCE(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error

func (PostgresDB) CreatePad added in v0.0.2

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

func (PostgresDB) CreateRefreshToken added in v0.5.0

func (d PostgresDB) CreateRefreshToken(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, active bool, accessTokenSignature string, requestedAt, expiresAt time.Time) error

func (PostgresDB) DeleteAccessToken added in v0.5.0

func (d PostgresDB) DeleteAccessToken(signature string) error

func (PostgresDB) DeleteAccessTokensByRequestID added in v0.5.0

func (d PostgresDB) DeleteAccessTokensByRequestID(requestID string) error

func (PostgresDB) DeleteOIDCSession added in v0.5.0

func (d PostgresDB) DeleteOIDCSession(signature string) error

func (PostgresDB) DeleteOIDCStorageValue added in v0.5.0

func (d PostgresDB) DeleteOIDCStorageValue(key string) error

func (PostgresDB) DeletePKCE added in v0.5.0

func (d PostgresDB) DeletePKCE(signature string) error

func (PostgresDB) DeleteRefreshToken added in v0.5.0

func (d PostgresDB) DeleteRefreshToken(signature string) error

func (PostgresDB) DoesPadExist added in v0.0.2

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

func (PostgresDB) GetAccessToken added in v0.5.0

func (d PostgresDB) GetAccessToken(signature string) (*OAuthTokenRow, error)

func (PostgresDB) GetAuthCode added in v0.5.0

func (d PostgresDB) GetAuthCode(signature string) (*OAuthTokenRow, error)

func (PostgresDB) GetAuthor added in v0.0.2

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

func (PostgresDB) GetAuthorByToken added in v0.0.2

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

func (PostgresDB) GetAuthorIdsOfPadChats added in v0.0.4

func (d PostgresDB) GetAuthorIdsOfPadChats(id string) (*[]string, error)

func (PostgresDB) GetAuthors added in v0.0.4

func (d PostgresDB) GetAuthors(
	ids []string,
) (*[]db.AuthorDB, 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) GetOIDCSession added in v0.5.0

func (d PostgresDB) GetOIDCSession(signature string) (*OAuthTokenRow, error)

func (PostgresDB) GetOIDCStorageValue added in v0.5.0

func (d PostgresDB) GetOIDCStorageValue(key string) (*string, error)

func (PostgresDB) GetPKCE added in v0.5.0

func (d PostgresDB) GetPKCE(signature string) (*OAuthTokenRow, error)

func (PostgresDB) GetPad added in v0.0.2

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

func (PostgresDB) GetPadByReadOnlyId added in v0.0.4

func (d PostgresDB) GetPadByReadOnlyId(readonlyId string) (*string, error)

func (PostgresDB) GetPadIds added in v0.0.2

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

func (PostgresDB) GetPadIdsOfAuthor added in v0.0.4

func (d PostgresDB) GetPadIdsOfAuthor(authorId string) (*[]string, error)

func (PostgresDB) GetReadonlyPad added in v0.0.2

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

func (PostgresDB) GetRefreshToken added in v0.5.0

func (d PostgresDB) GetRefreshToken(signature string) (*OAuthRefreshTokenRow, 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) GetServerVersion added in v0.0.5

func (d PostgresDB) GetServerVersion() (*db.ServerVersion, error)

func (PostgresDB) GetSessionById added in v0.0.2

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

func (PostgresDB) InvalidateAuthCode added in v0.5.0

func (d PostgresDB) InvalidateAuthCode(signature string) error

func (PostgresDB) Ping added in v0.0.5

func (d PostgresDB) Ping() 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) 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) RevokeRefreshToken added in v0.5.0

func (d PostgresDB) RevokeRefreshToken(signature string) error

func (PostgresDB) RevokeRefreshTokensByRequestID added in v0.5.0

func (d PostgresDB) RevokeRefreshTokensByRequestID(requestID 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) SaveServerVersion added in v0.0.5

func (d PostgresDB) SaveServerVersion(version string) error

func (PostgresDB) SetAuthorByToken added in v0.0.2

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

func (PostgresDB) SetOIDCStorageValue added in v0.5.0

func (d PostgresDB) SetOIDCStorageValue(key string, payload string) error

func (PostgresDB) SetReadOnlyId added in v0.0.4

func (d PostgresDB) SetReadOnlyId(padId string, readonlyId 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 Reader added in v0.0.4

type Reader interface {
	Scan(dest ...any) error
}

type SQLiteDB

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

func NewSQLiteDB added in v0.0.2

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

NewSQLiteDB 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) CreateAccessToken added in v0.5.0

func (d SQLiteDB) CreateAccessToken(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error

func (SQLiteDB) CreateAuthCode added in v0.5.0

func (d SQLiteDB) CreateAuthCode(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error

func (SQLiteDB) CreateOIDCSession added in v0.5.0

func (d SQLiteDB) CreateOIDCSession(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error

func (SQLiteDB) CreatePKCE added in v0.5.0

func (d SQLiteDB) CreatePKCE(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error

func (SQLiteDB) CreatePad

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

func (SQLiteDB) CreateRefreshToken added in v0.5.0

func (d SQLiteDB) CreateRefreshToken(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, active bool, accessTokenSignature string, requestedAt, expiresAt time.Time) error

func (SQLiteDB) DeleteAccessToken added in v0.5.0

func (d SQLiteDB) DeleteAccessToken(signature string) error

func (SQLiteDB) DeleteAccessTokensByRequestID added in v0.5.0

func (d SQLiteDB) DeleteAccessTokensByRequestID(requestID string) error

func (SQLiteDB) DeleteOIDCSession added in v0.5.0

func (d SQLiteDB) DeleteOIDCSession(signature string) error

func (SQLiteDB) DeleteOIDCStorageValue added in v0.5.0

func (d SQLiteDB) DeleteOIDCStorageValue(key string) error

func (SQLiteDB) DeletePKCE added in v0.5.0

func (d SQLiteDB) DeletePKCE(signature string) error

func (SQLiteDB) DeleteRefreshToken added in v0.5.0

func (d SQLiteDB) DeleteRefreshToken(signature string) error

func (SQLiteDB) DoesPadExist

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

func (SQLiteDB) GetAccessToken added in v0.5.0

func (d SQLiteDB) GetAccessToken(signature string) (*OAuthTokenRow, error)

func (SQLiteDB) GetAuthCode added in v0.5.0

func (d SQLiteDB) GetAuthCode(signature string) (*OAuthTokenRow, error)

func (SQLiteDB) GetAuthor

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

func (SQLiteDB) GetAuthorByToken

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

func (SQLiteDB) GetAuthorIdsOfPadChats added in v0.0.4

func (d SQLiteDB) GetAuthorIdsOfPadChats(id string) (*[]string, error)

func (SQLiteDB) GetAuthors added in v0.0.4

func (d SQLiteDB) GetAuthors(
	ids []string,
) (*[]db.AuthorDB, 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) GetOIDCSession added in v0.5.0

func (d SQLiteDB) GetOIDCSession(signature string) (*OAuthTokenRow, error)

func (SQLiteDB) GetOIDCStorageValue added in v0.5.0

func (d SQLiteDB) GetOIDCStorageValue(key string) (*string, error)

func (SQLiteDB) GetPKCE added in v0.5.0

func (d SQLiteDB) GetPKCE(signature string) (*OAuthTokenRow, error)

func (SQLiteDB) GetPad

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

func (SQLiteDB) GetPadByReadOnlyId added in v0.0.4

func (d SQLiteDB) GetPadByReadOnlyId(readonlyId string) (*string, error)

func (SQLiteDB) GetPadIds

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

func (SQLiteDB) GetPadIdsOfAuthor added in v0.0.4

func (d SQLiteDB) GetPadIdsOfAuthor(authorId string) (*[]string, error)

func (SQLiteDB) GetReadonlyPad

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

func (SQLiteDB) GetRefreshToken added in v0.5.0

func (d SQLiteDB) GetRefreshToken(signature string) (*OAuthRefreshTokenRow, 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) GetServerVersion added in v0.0.5

func (d SQLiteDB) GetServerVersion() (*db.ServerVersion, error)

func (SQLiteDB) GetSessionById

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

func (SQLiteDB) InvalidateAuthCode added in v0.5.0

func (d SQLiteDB) InvalidateAuthCode(signature string) error

func (SQLiteDB) Ping added in v0.0.5

func (d SQLiteDB) Ping() 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) RemoveRevisionsOfPad

func (d SQLiteDB) RemoveRevisionsOfPad(padId string) error

func (SQLiteDB) RemoveSessionById

func (d SQLiteDB) RemoveSessionById(sid string) error

func (SQLiteDB) RevokeRefreshToken added in v0.5.0

func (d SQLiteDB) RevokeRefreshToken(signature string) error

func (SQLiteDB) RevokeRefreshTokensByRequestID added in v0.5.0

func (d SQLiteDB) RevokeRefreshTokensByRequestID(requestID string) 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) SaveServerVersion added in v0.0.5

func (d SQLiteDB) SaveServerVersion(version string) error

func (SQLiteDB) SetAuthorByToken

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

func (SQLiteDB) SetOIDCStorageValue added in v0.5.0

func (d SQLiteDB) SetOIDCStorageValue(key string, payload string) error

func (SQLiteDB) SetReadOnlyId added in v0.0.4

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

func (SQLiteDB) SetSessionById

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

type ServerMethods added in v0.0.5

type ServerMethods interface {
	GetServerVersion() (*db.ServerVersion, error)
	SaveServerVersion(version string) 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