database

package
v0.0.0-...-8945333 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type Database

type Database interface {
	AcquireFunc(context.Context, func(*pgxpool.Conn) error) error
	BeginTx(context.Context, pgx.TxOptions) (pgx.Tx, error)
	Begin(context.Context) (pgx.Tx, error)
	Ping(context.Context) error
}

type GetNoteAccessRow

type GetNoteAccessRow struct {
	UserID uuid.UUID
	Access NotesAccessLevel
}

type GetNoteRow

type GetNoteRow struct {
	NoteID    uuid.UUID
	CreatedAt pgtype.Timestamptz
	CreatedBy uuid.NullUUID
	UpdatedAt pgtype.Timestamptz
	UpdatedBy uuid.NullUUID
	Title     string
	Body      string
}

type GetNoteTagsParams

type GetNoteTagsParams struct {
	UserID uuid.UUID
	NoteID uuid.UUID
}

type GetTagAccessRow

type GetTagAccessRow struct {
	UserID uuid.UUID
	Access NotesAccessLevel
}

type GetUserNoteAccessParams

type GetUserNoteAccessParams struct {
	NoteID uuid.UUID
	UserID uuid.UUID
}

type GetUserTagAccessParams

type GetUserTagAccessParams struct {
	TagID  uuid.UUID
	UserID uuid.UUID
}

type ListNotesParams

type ListNotesParams struct {
	UserID     uuid.UUID
	LastNoteID uuid.NullUUID
	PageSize   int64
}

type ListNotesRow

type ListNotesRow struct {
	NoteID uuid.UUID
	Title  string
}

type ListTagsParams

type ListTagsParams struct {
	UserID       uuid.UUID
	LastTagID    uuid.NullUUID
	SearchString string
	PageSize     int64
}

type ListTagsRow

type ListTagsRow struct {
	TagID  uuid.UUID
	Name   string
	Access NotesAccessLevel
}

type NotesAccessLevel

type NotesAccessLevel string
const (
	NotesAccessLevelOwner  NotesAccessLevel = "owner"
	NotesAccessLevelEditor NotesAccessLevel = "editor"
	NotesAccessLevelViewer NotesAccessLevel = "viewer"
)

func (*NotesAccessLevel) Scan

func (e *NotesAccessLevel) Scan(src interface{}) error

func (NotesAccessLevel) Valid

func (e NotesAccessLevel) Valid() bool

type NotesTag

type NotesTag struct {
	TagID uuid.UUID
	Name  string
}

type NotesUser

type NotesUser struct {
	UserID     uuid.UUID
	Name       string
	CreatedAt  pgtype.Timestamptz
	LastSignIn pgtype.Timestamptz
	Active     bool
}

type NullNotesAccessLevel

type NullNotesAccessLevel struct {
	NotesAccessLevel NotesAccessLevel
	Valid            bool // Valid is true if NotesAccessLevel is not NULL
}

func (*NullNotesAccessLevel) Scan

func (ns *NullNotesAccessLevel) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullNotesAccessLevel) Value

func (ns NullNotesAccessLevel) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Queries

type Queries struct {
}

func New

func New() *Queries

func (*Queries) DeleteNote

func (q *Queries) DeleteNote(ctx context.Context, db DBTX, noteID uuid.UUID) (int64, error)

func (*Queries) DeleteTag

func (q *Queries) DeleteTag(ctx context.Context, db DBTX, tagID uuid.UUID) (int64, error)

func (*Queries) DeleteUser

func (q *Queries) DeleteUser(ctx context.Context, db DBTX, userID uuid.UUID) (int64, error)

func (*Queries) GetNote

func (q *Queries) GetNote(ctx context.Context, db DBTX, noteID uuid.UUID) (GetNoteRow, error)

func (*Queries) GetNoteAccess

func (q *Queries) GetNoteAccess(ctx context.Context, db DBTX, noteID uuid.UUID) ([]GetNoteAccessRow, error)

func (*Queries) GetNoteTags

func (q *Queries) GetNoteTags(ctx context.Context, db DBTX, arg GetNoteTagsParams) ([]NotesTag, error)

func (*Queries) GetTag

func (q *Queries) GetTag(ctx context.Context, db DBTX, tagID uuid.UUID) (NotesTag, error)

func (*Queries) GetTagAccess

func (q *Queries) GetTagAccess(ctx context.Context, db DBTX, tagID uuid.UUID) ([]GetTagAccessRow, error)

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, db DBTX, noteID uuid.UUID) (NotesUser, error)

func (*Queries) GetUserNoteAccess

func (q *Queries) GetUserNoteAccess(ctx context.Context, db DBTX, arg GetUserNoteAccessParams) (NotesAccessLevel, error)

func (*Queries) GetUserTagAccess

func (q *Queries) GetUserTagAccess(ctx context.Context, db DBTX, arg GetUserTagAccessParams) (NotesAccessLevel, error)

func (*Queries) ListNotes

func (q *Queries) ListNotes(ctx context.Context, db DBTX, arg ListNotesParams) ([]ListNotesRow, error)

func (*Queries) ListTags

func (q *Queries) ListTags(ctx context.Context, db DBTX, arg ListTagsParams) ([]ListTagsRow, error)

func (*Queries) SaveNote

func (q *Queries) SaveNote(ctx context.Context, db DBTX, arg SaveNoteParams) error

func (*Queries) SaveTag

func (q *Queries) SaveTag(ctx context.Context, db DBTX, arg SaveTagParams) error

func (*Queries) SaveUser

func (q *Queries) SaveUser(ctx context.Context, db DBTX, arg SaveUserParams) error

func (*Queries) SearchNotesWithTag

func (q *Queries) SearchNotesWithTag(ctx context.Context, db DBTX, arg SearchNotesWithTagParams) ([]SearchNotesWithTagRow, error)

func (*Queries) SearchNotesWithText

func (q *Queries) SearchNotesWithText(ctx context.Context, db DBTX, arg SearchNotesWithTextParams) ([]SearchNotesWithTextRow, error)

func (*Queries) SearchNotesWithTextAndTag

func (q *Queries) SearchNotesWithTextAndTag(ctx context.Context, db DBTX, arg SearchNotesWithTextAndTagParams) ([]SearchNotesWithTextAndTagRow, error)

func (*Queries) SetNoteAccess

func (q *Queries) SetNoteAccess(ctx context.Context, db DBTX, arg SetNoteAccessParams) error

func (*Queries) SetNoteTags

func (q *Queries) SetNoteTags(ctx context.Context, db DBTX, arg SetNoteTagsParams) error

func (*Queries) SetTagAccess

func (q *Queries) SetTagAccess(ctx context.Context, db DBTX, arg SetTagAccessParams) error

type SaveNoteParams

type SaveNoteParams struct {
	NoteID    uuid.UUID
	CreatedAt pgtype.Timestamptz
	CreatedBy uuid.NullUUID
	UpdatedAt pgtype.Timestamptz
	UpdatedBy uuid.NullUUID
	Title     string
	Body      string
}

type SaveTagParams

type SaveTagParams struct {
	TagID uuid.UUID
	Name  string
}

type SaveUserParams

type SaveUserParams struct {
	UserID     uuid.UUID
	Name       string
	CreatedAt  pgtype.Timestamptz
	LastSignIn pgtype.Timestamptz
	Active     bool
}

type SearchNotesWithTagParams

type SearchNotesWithTagParams struct {
	UserID     uuid.UUID
	TagID      uuid.UUID
	LastNoteID uuid.NullUUID
	PageSize   int64
}

type SearchNotesWithTagRow

type SearchNotesWithTagRow struct {
	NoteID uuid.UUID
	Title  string
}

type SearchNotesWithTextAndTagParams

type SearchNotesWithTextAndTagParams struct {
	TextSearch string
	UserID     uuid.UUID
	TagID      uuid.UUID
	LastRank   pgtype.Float4
	PageSize   int64
}

type SearchNotesWithTextAndTagRow

type SearchNotesWithTextAndTagRow struct {
	NoteID uuid.UUID
	Title  string
	Rank   float32
	Match  pgtype.Text
}

type SearchNotesWithTextParams

type SearchNotesWithTextParams struct {
	TextSearch string
	UserID     uuid.UUID
	LastRank   pgtype.Float4
	PageSize   int64
}

type SearchNotesWithTextRow

type SearchNotesWithTextRow struct {
	NoteID uuid.UUID
	Title  string
	Rank   float32
	Match  pgtype.Text
}

type SetNoteAccessParams

type SetNoteAccessParams struct {
	Column1 uuid.NullUUID
	Column2 NullNotesAccessLevel
	Column3 uuid.NullUUID
}

type SetNoteTagsParams

type SetNoteTagsParams struct {
	Column1 uuid.NullUUID
	Column2 uuid.NullUUID
}

type SetTagAccessParams

type SetTagAccessParams struct {
	Column1 uuid.NullUUID
	Column2 NullNotesAccessLevel
	Column3 uuid.NullUUID
}

Jump to

Keyboard shortcuts

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