Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 2,769 for user (0.04 sec)

  1. docs/ko/docs/tutorial/security/get-current-user.md

    ```
    
    ////
    
    Pydantic 모델인 `User`로 `current_user`의 타입을 선언하는 것을 알아야 합니다.
    
    이것은 모든 완료 및 타입 검사를 통해 함수 내부에서 우리를 도울 것입니다.
    
    /// tip | "팁"
    
    요청 본문도 Pydantic 모델로 선언된다는 것을 기억할 것입니다.
    
    여기서 **FastAPI**는 `Depends`를 사용하고 있기 때문에 혼동되지 않습니다.
    
    ///
    
    /// check | "확인"
    
    이 의존성 시스템이 설계된 방식은 모두 `User` 모델을 반환하는 다양한 의존성(다른 "의존적인")을 가질 수 있도록 합니다.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 5.6K bytes
    - Viewed (0)
  2. docs/ja/docs/tutorial/security/get-current-user.md

    `get_current_user` は作成した(偽物の)ユーティリティ関数を使って、 `str` としてトークンを受け取り、先ほどのPydanticの `User` モデルを返却します:
    
    ```Python hl_lines="19-22  26-27"
    {!../../docs_src/security/tutorial002.py!}
    ```
    
    ## 現在のユーザーの注入
    
    ですので、 `get_current_user` に対して同様に *path operation* の中で `Depends` を利用できます。
    
    ```Python hl_lines="31"
    {!../../docs_src/security/tutorial002.py!}
    ```
    
    Pydanticモデルの `User` として、 `current_user` の型を宣言することに注意してください。
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 5.6K bytes
    - Viewed (0)
  3. tests/upsert_test.go

    	if user6.Name != "find or init" || user6.ID == 0 || user6.Age != 44 {
    		t.Errorf("user should be found and updated with assigned attrs")
    	}
    }
    
    func TestFindOrCreate(t *testing.T) {
    	var user1, user2, user3, user4, user5, user6, user7, user8 User
    	if err := DB.Where(&User{Name: "find or create", Age: 33}).FirstOrCreate(&user1).Error; err != nil {
    		t.Errorf("no error should happen when FirstOrInit, but got %v", err)
    	}
    
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Sep 05 07:39:19 UTC 2022
    - 11.4K bytes
    - Viewed (0)
  4. tests/update_test.go

    	if users[1].Name != "update_column_02_newname" || users[1].Age != 100 {
    		t.Errorf("user 2 should be updated with update column")
    	}
    	AssertEqual(t, lastUpdatedAt.UnixNano(), users[1].UpdatedAt.UnixNano())
    
    	// user2 should not be updated
    	var user1, user2 User
    	DB.First(&user1, users[0].ID)
    	DB.First(&user2, users[1].ID)
    	CheckUser(t, user1, *users[0])
    	CheckUser(t, user2, *users[1])
    
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Dec 04 03:50:58 UTC 2023
    - 30.3K bytes
    - Viewed (0)
  5. tests/scan_test.go

    	if err := DB.Table("users").Select("id, name, age").Where("id = ?", user3.ID).Scan(&resInt2).Error; err != nil {
    		t.Fatalf("Failed to query with pointer of value, got error %v", err)
    	} else if resInt2.(*User).ID != user3.ID || resInt2.(*User).Name != user3.Name || resInt2.(*User).Age != user3.Age {
    		t.Fatalf("Scan into struct should work, got %#v, should %#v", resInt2, user3)
    	}
    
    	var resInt3 interface{}
    	resInt3 = []User{}
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Wed Jun 12 10:57:36 UTC 2024
    - 10.9K bytes
    - Viewed (0)
  6. tests/transaction_test.go

    	if err := tx.First(&User{}, "name = ?", user.Name).Error; err != nil {
    		t.Fatalf("Should find saved record")
    	}
    
    	if err := tx.SavePoint("save_point1").Error; err != nil {
    		t.Fatalf("Failed to save point, got error %v", err)
    	}
    
    	user1 := *GetUser("transaction-save-point-1", Config{})
    	tx.Create(&user1)
    
    	if err := tx.First(&User{}, "name = ?", user1.Name).Error; err != nil {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Sat Sep 14 12:58:29 UTC 2024
    - 12.9K bytes
    - Viewed (0)
  7. tests/associations_many2many_test.go

    func TestMany2ManyAssociation(t *testing.T) {
    	user := *GetUser("many2many", Config{Languages: 2})
    
    	if err := DB.Create(&user).Error; err != nil {
    		t.Fatalf("errors happened when create: %v", err)
    	}
    
    	CheckUser(t, user, user)
    
    	// Find
    	var user2 User
    	DB.Find(&user2, "id = ?", user.ID)
    	DB.Model(&user2).Association("Languages").Find(&user2.Languages)
    
    	CheckUser(t, user2, user)
    
    	// Count
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Sat Jun 10 13:05:19 UTC 2023
    - 13.2K bytes
    - Viewed (0)
  8. tests/update_many2many_test.go

    	}
    
    	var user3 User
    	DB.Preload("Languages").Preload("Friends").Find(&user3, "id = ?", user.ID)
    	CheckUser(t, user2, user3)
    
    	if err := DB.Session(&gorm.Session{FullSaveAssociations: true}).Save(&user).Error; err != nil {
    		t.Fatalf("errors happened when update: %v", err)
    	}
    
    	var user4 User
    	DB.Preload("Languages").Preload("Friends").Find(&user4, "id = ?", user.ID)
    	CheckUser(t, user4, user)
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Jan 06 07:02:53 UTC 2022
    - 1.3K bytes
    - Viewed (0)
  9. tests/sql_builder_test.go

    	})
    	assertEqualSQL(t, `SELECT * FROM "users" WHERE "users"."name" = 'bar' AND "users"."age" = 12 ORDER BY name ASC,"users"."id" DESC LIMIT 1 OFFSET 5`, sql)
    
    	// create
    	user := &User{Name: "foo", Age: 20}
    	user.CreatedAt = date
    	user.UpdatedAt = date
    	sql = DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Fri Jan 12 08:42:21 UTC 2024
    - 16.7K bytes
    - Viewed (0)
  10. tests/delete_test.go

    		}
    	}
    
    	for _, user := range []User{users[0], users[2]} {
    		result = User{}
    		if err := DB.Where("id = ?", user.ID).First(&result).Error; err != nil {
    			t.Errorf("no error should returns when query %v, but got %v", user.ID, err)
    		}
    	}
    
    	if err := DB.Delete(&users[0]).Error; err != nil {
    		t.Errorf("errors happened when delete: %v", err)
    	}
    
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Tue Oct 10 07:03:34 UTC 2023
    - 9.4K bytes
    - Viewed (0)
Back to top