Documentation ¶
Index ¶
- Constants
- func Healthcheck(tx Queryer) (string, error)
- func TestCreateSchema(cfg DBConfig, schema, user string) error
- func TestCreateTables(cfg DBConfig, path string) error
- func TestDropSchema(cfg DBConfig, schema string) error
- func UpdateUser(tx Queryer, user *TodoUser) error
- type AccessToken
- type DB
- type DBConfig
- type DBer
- type Queryer
- type Todo
- type TodoUser
- type Txer
Constants ¶
const ( UserStatusActive = "active" UserStatusInactive = "inactive" )
User status
Variables ¶
This section is empty.
Functions ¶
func TestCreateSchema ¶
TestCreateSchema set up test schema
func TestCreateTables ¶
TestCreateTables create test tables
func TestDropSchema ¶
TestDropSchema set up test schema
Types ¶
type AccessToken ¶
type AccessToken struct { Token string // token UserID string // user_id GeneratedAt time.Time // generated_at IsActive bool // is_active }
AccessToken represents gotodoit_api.access_token
func GetAccessTokenByPk ¶
func GetAccessTokenByPk(db Queryer, pk0 string) (*AccessToken, error)
GetAccessTokenByPk select the AccessToken from the database.
func TestCreateAccessTokenData ¶
func TestCreateAccessTokenData(t *testing.T, tx Queryer, u *TodoUser) *AccessToken
TestCreateAccessTokenData create test data
func (*AccessToken) Create ¶
func (r *AccessToken) Create(db Queryer) error
Create inserts the AccessToken to the database.
type DBConfig ¶
type DBConfig struct { Host string User string UserPass string Port string DBName string SSLMode string }
DBConfig config
type Queryer ¶
type Queryer interface { Exec(string, ...interface{}) (sql.Result, error) Query(string, ...interface{}) (*sql.Rows, error) QueryRow(string, ...interface{}) *sql.Row }
Queryer database/sql compatible query interface
type Todo ¶
type Todo struct { UUID string // uuid UserID string // user_id Name string // name Duration int64 // duration StartedAt time.Time // started_at IsCompleted bool // is_completed }
Todo represents gotodoit_api.todo
func GetTodoByPk ¶
GetTodoByPk select the Todo from the database.
func GetTodosByUserID ¶
GetTodosByUserID get todos by user id
func GetUserTodoByID ¶
GetUserTodoByID get todos by user id
func TestCreateTodoData ¶
TestCreateTodoData create todo test data
type TodoUser ¶
type TodoUser struct { UUID string // uuid Username string // username Email string // email Password string // password Status string // status }
TodoUser represents gotodoit_api.todo_user
func CreateUser ¶
CreateUser creates user
func GetTodoUserByPk ¶
GetTodoUserByPk select the TodoUser from the database.
func GetUserByAccessToken ¶
GetUserByAccessToken get user by access token
func TestCreateUserData ¶
TestCreateUserData create user test data