CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 23:03:43 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=8e03d92c14d47eafc7b2cd23d16c1c5426acd37ac601e75c3dcc4e24b071f2c4a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22-TL4wT8zDQoC3a-KxR3o-uq-FsOWUBRk%22%3B%7D; HttpOnly; Path=/
cf-ray: 98da3b6f4835c1d2-BLR
TaskIt - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // setup.go
- package taskit
- import (
- "encore.dev/storage/sqldb"
- "gorm.io/driver/postgres"
- "gorm.io/gorm"
- )
- //encore:service
- type Service struct {
- db *gorm.DB
- }
- func initService() (*Service, error) {
- gormDB, err := gorm.Open(postgres.New(postgres.Config{
- Conn: db.Stdlib(),
- }))
- if err != nil {
- return nil, err
- }
- return &Service{db: gormDB}, nil
- }
- var db = sqldb.NewDatabase("taskit", sqldb.DatabaseConfig{
- Migrations: "./migrations",
- })
- // user.go
- package taskit
- import (
- "context"
- "github.com/google/uuid"
- )
- type User struct {
- ID string `json:"id"`
- FirstName string `json:"first_name"`
- LastName string `json:"last_name"`
- Email string `json:"email"`
- ProfilePic string `json:"profile_pic"`
- Password string `json:"password"`
- }
- //encore:api public method=POST path=/taskit/users
- func (s *Service) CreateUser(ctx context.Context, user *User) (*User, error) {
- user.ID = uuid.New().String()
- err := s.db.Create(&user).Error
- // err := s.db.Omit("id").Create(&user).Error
- if err != nil {
- return nil, err
- }
- return user, nil
- }
- type UserListRes struct {
- Users []*User `json:"users"`
- }
- //encore:api public method=GET path=/taskit/users
- func (s *Service) GetUsers(ctx context.Context) (*UserListRes, error) {
- var users []*User
- err := s.db.Find(&users).Error
- if err != nil {
- return nil, err
- }
- return &UserListRes{Users: users}, nil
- }
- //encore:api public method=GET path=/users/:userId
- func (s *Service) GetUser(ctx context.Context, userId string) (user *User, err error) {
- err = s.db.First(&user, "id = ?", userId).Error
- return
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
π EASY MONEY GUIDE β
Working I
JavaScript | 1 min ago | 0.25 KB
-
π Instant BTC Profit Method β
Working O
JavaScript | 1 min ago | 0.25 KB
-
β
Make $2500 in 20 minutesβ F
JavaScript | 1 min ago | 0.25 KB
-
π Swapzone +37% glitch β J
JavaScript | 2 min ago | 0.25 KB
-
β
β Make huge profits on trading ββ 5
JavaScript | 2 min ago | 0.25 KB
-
β
Marketplace Glitch β
Working NEVER SEEN BE...
JavaScript | 2 min ago | 0.25 KB
-
ββ
Exploit 2500$ in 15 Minutesβββ B
JavaScript | 2 min ago | 0.25 KB
-
π EASY MONEY GUIDE β
Working I
JavaScript | 2 min ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand