refactoring

This commit is contained in:
santhoshivan23 2023-06-06 00:18:05 +05:30
parent 2c339a6bfd
commit 6cd6af150b
2 changed files with 21 additions and 23 deletions

View file

@ -3,7 +3,6 @@ package postgres
import ( import (
"context" "context"
"database/sql" "database/sql"
"fmt"
) )
const registrationTokensSchema = ` const registrationTokensSchema = `
@ -22,6 +21,5 @@ func CreateRegistrationTokensTable(db *sql.DB) error {
} }
func RegistrationTokenExists(ctx context.Context, tx *sql.Tx, token string) (bool, error) { func RegistrationTokenExists(ctx context.Context, tx *sql.Tx, token string) (bool, error) {
fmt.Println("here!!")
return true, nil return true, nil
} }

View file

@ -31,31 +31,31 @@ const redactionsArePermanent = true
type Database struct { type Database struct {
DB *sql.DB DB *sql.DB
EventDatabase EventDatabase
Cache caching.RoomServerCaches Cache caching.RoomServerCaches
Writer sqlutil.Writer Writer sqlutil.Writer
RoomsTable tables.Rooms RoomsTable tables.Rooms
StateSnapshotTable tables.StateSnapshot StateSnapshotTable tables.StateSnapshot
StateBlockTable tables.StateBlock StateBlockTable tables.StateBlock
RoomAliasesTable tables.RoomAliases RoomAliasesTable tables.RoomAliases
InvitesTable tables.Invites InvitesTable tables.Invites
MembershipTable tables.Membership MembershipTable tables.Membership
PublishedTable tables.Published PublishedTable tables.Published
Purge tables.Purge Purge tables.Purge
GetRoomUpdaterFn func(ctx context.Context, roomInfo *types.RoomInfo) (*RoomUpdater, error) GetRoomUpdaterFn func(ctx context.Context, roomInfo *types.RoomInfo) (*RoomUpdater, error)
RegistrationTokensTable tables.RegistrationTokens
} }
// EventDatabase contains all tables needed to work with events // EventDatabase contains all tables needed to work with events
type EventDatabase struct { type EventDatabase struct {
DB *sql.DB DB *sql.DB
Cache caching.RoomServerCaches Cache caching.RoomServerCaches
Writer sqlutil.Writer Writer sqlutil.Writer
EventsTable tables.Events EventsTable tables.Events
EventJSONTable tables.EventJSON EventJSONTable tables.EventJSON
EventTypesTable tables.EventTypes EventTypesTable tables.EventTypes
EventStateKeysTable tables.EventStateKeys EventStateKeysTable tables.EventStateKeys
PrevEventsTable tables.PreviousEvents PrevEventsTable tables.PreviousEvents
RedactionsTable tables.Redactions RedactionsTable tables.Redactions
RegistrationTokensTable tables.RegistrationTokens
} }
func (d *Database) RegistrationTokenExists(ctx context.Context, token string) (bool, error) { func (d *Database) RegistrationTokenExists(ctx context.Context, token string) (bool, error) {