Trên GitHub, jmoiron/modl đã đạt 481 sao, ngôn ngữ Go. golang database modelling library
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Modl is a library which provides database modelling and mapping. It is a fork of
James Cooper's wonderful gorp.
Note. Modl's public facing interface is considered unfinished and open to
change. The current API will not be broken lightly, but additions are likely.
As Gorp's behavior moves on, Modl may adopt some of it or may not.
Goals
Modl's goal is to clean up bits of gorp's API, add some additional features
like query building helpers and additional control over SQL generation, and
to reuse lower level abstractions provided in sqlx.
The driving philosophies behind modl are:
If something can be done in database/sql, do it that way
Go is not a good declarative language, do not abuse struct tags
Expose as much as possible to facilitate extension by other libraries
Avoid abstractions which provide initial convenience but must eventually be abandoned
Avoid reflect and cache its results where possible, use where necessary
Features
Bind struct models to tables
CRUD helpers for bound structs
Create schema from database model (great for testing)
Pre/post insert/update/delete hooks
Automatic binding of auto increment PKs after insert
Delete & Fetch by primary keys (w/ multi-key support)
Sql trace logging
Bind arbitrary SQL queries to a struct
Optional optimistic locking using a version column (for update/deletes)
Differences from Gorp
Since modl is a gorp fork, here are some of its major behavioral differences:
Field names are mapped to all-lowercase sql equivalents. Capitalization is
an artifact of visibility, and this was required for compatibility with sqlx.
No more struct/slice returns, pass pointers to methods instead
Many panics in gorp are errors in modl
TypeConverters are removed in favor of implementing sql.Scanner & driver.Valuer
for custom types.
Testing
To use the test-all script, set the following environment variables:
# mysql DSN, note parseTime arg for time scanning support:
MODL_MYSQL_DSN="username:password@/dbname?parseTime=true"
# postgres DSN, like:
MODL_POSTGRES_DSN="user=username password=pw dbname=dbname sslmode=disable"
# sqlite DSN, which is a path
MODL_SQLITE_DSN="/dev/shm/modltest.db"
# optional, will fail the test if any DBs are skipped (for CI, mostly)
MODL_FAIL_ON_SKIP=true
In addition to this, you can create an environ file in this directory which
will be sourced and ignored by git. You can continue to use the MODL_TEST_DSN
and MODL_TEST_DIALECT variables if you want to manually run go test or if
you want to run the benchmarks, as described below.
The original README.md follows:
API Stability
The API of Modl has been quite stable since its conception. Changes to the API
are avoided as much as possible but there is currently no promise of forward or
backward compatibility.
Supported Databases
Modl relies heavily upon the database/sql package, and has a
Dialect interface which can be used to smooth over
differences between databases. There is a list of sql drivers
on the Go wiki, most of which Modl should be compatible with. Dialects
are provided for:
MySQL
PostgreSQL
sqlite3
The test suite is continuously run against all of these databases.
Documentation
API Documentation is available on godoc.
Performance
Modl performs similar to Gorp. There are benchmarks in modl_test.go which
will benchmark native querying w/ database/sql and manual Scanning with what
modl does. Modl should perform between 2-3% slower than hand-done SQL.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/jmoiron/modl là nguồn chính thức.
jmoiron/modl có bao nhiêu sao?
jmoiron/modl có 481 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/jmoiron/modl. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
jmoiron/modl có phải mã nguồn mở không?
Có — jmoiron/modl phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/jmoiron/modl.
jmoiron/modl có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho jmoiron/modl. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
jmoiron/modl có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho jmoiron/modl. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
jmoiron/modl còn đang phát triển không?
Commit gần nhất trên jmoiron/modl là 7.8 năm trước (theo timestamp GitHub). Repo có 43 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về modl?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về modl.