database

package
v0.0.0-...-4d260af Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCategorySliceDTOs

func GetCategorySliceDTOs(categories []Category) []interface{}

func GetDTOs

func GetDTOs(dtos []DTO) []interface{}

func GetNoteSliceDTO

func GetNoteSliceDTO(notes []Note) []interface{}

func GetNoteWCategorySliceDTO

func GetNoteWCategorySliceDTO(notes []GetNotesByUserRow) []interface{}

Types

type Category

type Category struct {
	ID     uuid.UUID
	Name   string
	UserID uuid.UUID
}

func (*Category) GetDTO

func (c *Category) GetDTO() interface{}

type CategoryDTO

type CategoryDTO struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
}

type CreateCategoryParams

type CreateCategoryParams struct {
	ID     uuid.UUID
	Name   string
	UserID uuid.UUID
}

type CreateNoteCategoryParams

type CreateNoteCategoryParams struct {
	NoteID     uuid.UUID
	CategoryID uuid.UUID
}

type CreateNoteParams

type CreateNoteParams struct {
	ID        uuid.UUID
	Title     string
	Body      string
	UserID    uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
}

type CreateUserParams

type CreateUserParams struct {
	ID        uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
	Username  string
	Password  string
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type DTO

type DTO interface {
	GetDTO() interface{}
}

type DeleteCategoryByIdParams

type DeleteCategoryByIdParams struct {
	ID     uuid.UUID
	UserID uuid.UUID
}

type GetCategoryByIdParams

type GetCategoryByIdParams struct {
	ID     uuid.UUID
	UserID uuid.UUID
}

type GetNoteByIdParams

type GetNoteByIdParams struct {
	ID     uuid.UUID
	UserID uuid.UUID
}

type GetNoteByIdRow

type GetNoteByIdRow struct {
	Note       Note
	Categories json.RawMessage
}

type GetNotesByUserParams

type GetNotesByUserParams struct {
	UserID  uuid.UUID
	Column2 interface{}
	Column3 []uuid.UUID
}

type GetNotesByUserRow

type GetNotesByUserRow struct {
	Note       Note
	Categories json.RawMessage
}

func (*GetNotesByUserRow) GetDTO

func (n *GetNotesByUserRow) GetDTO() interface{}

type Note

type Note struct {
	ID        uuid.UUID
	Title     string
	Body      string
	UserID    uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (*Note) GetDTO

func (n *Note) GetDTO() interface{}

type NoteCategory

type NoteCategory struct {
	NoteID     uuid.UUID
	CategoryID uuid.UUID
}

type NoteDTO

type NoteDTO struct {
	ID        uuid.UUID `json:"id"`
	Title     string    `json:"title"`
	Body      string    `json:"body"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type NoteWCategoryDTO

type NoteWCategoryDTO struct {
	Note     NoteDTO       `json:"note"`
	Category []interface{} `json:"categories"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateCategory

func (q *Queries) CreateCategory(ctx context.Context, arg CreateCategoryParams) (Category, error)

func (*Queries) CreateNote

func (q *Queries) CreateNote(ctx context.Context, arg CreateNoteParams) (Note, error)

func (*Queries) CreateNoteCategory

func (q *Queries) CreateNoteCategory(ctx context.Context, arg CreateNoteCategoryParams) (NoteCategory, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)

func (*Queries) DeleteCategoryById

func (q *Queries) DeleteCategoryById(ctx context.Context, arg DeleteCategoryByIdParams) error

func (*Queries) GetCategoriesByUser

func (q *Queries) GetCategoriesByUser(ctx context.Context, userID uuid.UUID) ([]Category, error)

func (*Queries) GetCategoryById

func (q *Queries) GetCategoryById(ctx context.Context, arg GetCategoryByIdParams) (Category, error)

func (*Queries) GetNoteById

func (q *Queries) GetNoteById(ctx context.Context, arg GetNoteByIdParams) (GetNoteByIdRow, error)

func (*Queries) GetNotesByUser

func (q *Queries) GetNotesByUser(ctx context.Context, arg GetNotesByUserParams) ([]GetNotesByUserRow, error)

func (*Queries) GetUserById

func (q *Queries) GetUserById(ctx context.Context, id uuid.UUID) (User, error)

func (*Queries) GetUserByUsername

func (q *Queries) GetUserByUsername(ctx context.Context, username string) (User, error)

func (*Queries) UpdateNoteTitleBody

func (q *Queries) UpdateNoteTitleBody(ctx context.Context, arg UpdateNoteTitleBodyParams) (Note, error)

func (*Queries) UpdateTokens

func (q *Queries) UpdateTokens(ctx context.Context, arg UpdateTokensParams) (User, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type UpdateNoteTitleBodyParams

type UpdateNoteTitleBodyParams struct {
	Title     string
	Body      string
	UpdatedAt time.Time
	ID        uuid.UUID
}

type UpdateTokensParams

type UpdateTokensParams struct {
	Token        sql.NullString
	RefreshToken sql.NullString
	ID           uuid.UUID
}

type User

type User struct {
	ID           uuid.UUID
	CreatedAt    time.Time
	UpdatedAt    time.Time
	Username     string
	Password     string
	Token        sql.NullString
	RefreshToken sql.NullString
}

func (*User) GetDTO

func (u *User) GetDTO() interface{}

type UserDTO

type UserDTO struct {
	ID        uuid.UUID `json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Username  string    `json:"username"`
}

Jump to

Keyboard shortcuts

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