Documentation
¶
Index ¶
- func ApplySchema(db *sql.DB, schema string) error
- func NewDB(dsn string) (*sql.DB, error)
- type CreateProjectParams
- type CreateUserParams
- type DBTX
- type Epic
- type GetProjectsRow
- type Project
- type Queries
- func (q *Queries) CreateProject(ctx context.Context, arg CreateProjectParams) (Project, error)
- func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
- func (q *Queries) GetProject(ctx context.Context, id int64) (Project, error)
- func (q *Queries) GetProjects(ctx context.Context) ([]GetProjectsRow, error)
- func (q *Queries) GetUser(ctx context.Context, id int64) (User, error)
- func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error)
- func (q *Queries) GetUsers(ctx context.Context) ([]User, error)
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplySchema ¶
ApplySchema applies the schema to the given database.
It takes a *sql.DB as a parameter, which represents the database connection. The function reads the schema from the "schema.sql" file using the Schema embed.FS. It then begins a transaction on the database, executes the schema SQL statements, and commits the transaction. If any error occurs during the process, it is returned.
Returns an error if there was a problem reading the schema file or executing the SQL statements.
Types ¶
type CreateProjectParams ¶
type CreateProjectParams struct { Name string `db:"name" json:"name"` Description sql.NullString `db:"description" json:"description"` UserID int64 `db:"user_id" json:"user_id"` }
type CreateUserParams ¶
type Epic ¶
type Epic struct { ID int64 `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` Name string `db:"name" json:"name"` Description sql.NullString `db:"description" json:"description"` UserID int64 `db:"user_id" json:"user_id"` }
type GetProjectsRow ¶
type Project ¶
type Project struct { ID int64 `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` Name string `db:"name" json:"name"` Description sql.NullString `db:"description" json:"description"` UserID int64 `db:"user_id" json:"user_id"` }
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) CreateProject ¶
func (*Queries) CreateUser ¶
func (*Queries) GetProject ¶
func (*Queries) GetProjects ¶
func (q *Queries) GetProjects(ctx context.Context) ([]GetProjectsRow, error)
func (*Queries) GetUserByEmail ¶
type User ¶
type User struct { ID int64 `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` Email string `db:"email" json:"email"` FirstName string `db:"first_name" json:"first_name"` LastName string `db:"last_name" json:"last_name"` Password string `db:"password" json:"password"` Role string `db:"role" json:"role"` }
Click to show internal directories.
Click to hide internal directories.