Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

test(mysql): add Lock/Omit/Cache/Batch tests#4706

Open
lingcoder wants to merge 1 commit intogogf:masterfrom
lingcoder:test/mysql-lock-omit-cache-batch
Open

test(mysql): add Lock/Omit/Cache/Batch tests#4706
lingcoder wants to merge 1 commit intogogf:masterfrom
lingcoder:test/mysql-lock-omit-cache-batch

Conversation

@lingcoder
Copy link
Contributor

Summary

  • Add Lock/LockUpdate/LockShared tests
  • Add OmitNil/OmitEmpty/OmitNilData tests
  • Add Cache mechanism tests
  • Add Batch operation tests

Test coverage added: ~34 test functions across 4 files

Ref #4689

Test plan

cd contrib/drivers/mysql
go test -v -run "TestModel_Lock|TestModel_Omit|TestModel_Cache|TestModel_Batch"

@lingcoder lingcoder force-pushed the test/mysql-lock-omit-cache-batch branch from 88fe47e to 807f718 Compare February 13, 2026 13:11
Add comprehensive tests for Lock, Omit, Cache, and Batch features.

## New Test Coverage

### Lock Tests (mysql_z_unit_feature_lock_test.go)
- Lock() for SELECT FOR UPDATE
- LockUpdate() for SELECT FOR UPDATE
- Lock with LOCK IN SHARE MODE (MySQL 5.7+ compatible)
- Lock behavior in transactions
- Note: MySQL 8.0+ features (FOR SHARE, SKIP LOCKED) excluded for compatibility

### Omit Tests (mysql_z_unit_feature_omit_test.go)
- OmitEmpty() filtering
- OmitNil() filtering
- OmitNilData() filtering (Map-based)
- OmitEmptyData() filtering
- Combination with Fields/FieldsEx

### Cache Tests (mysql_z_unit_feature_cache_test.go)
- Cache() basic operations
- Cache with different durations
- Cache invalidation on write
- Cache with transactions

### Batch Tests (mysql_z_unit_feature_batch_test.go)
- Batch() insert operations
- BatchSave() operations
- Large batch processing
- Batch with transactions

## Total Added
~30 test functions across 4 files, 1200+ lines

Ref gogf#4689
@lingcoder lingcoder force-pushed the test/mysql-lock-omit-cache-batch branch from 807f718 to 344b08e Compare February 13, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant