thinkphp源碼無差别閱讀(二十六)
ORM閱讀
db/Fetch.php
- 屬性:query、connection、builder
- 構造方法:__construct
- 聚合查詢:aggregate
- 擷取某個字段的值:value
- 擷取某列的值:column
- 插入:insert
- 擷取插入的ID:insertGetId
- 儲存資料:save
- 插入多條:insertAll
- 通過select插入:selectInsert
- 更新:update
- 删除記錄:delete
- 查詢記錄:select
- 查詢一條:find
- 查詢多條,不存在就抛出異常:selectOrFail
- 查詢一條,不存在就抛出異常:findOrFail
- 擷取實際的sql:fetch
- count查詢:count
- sum查詢:sum
- min查詢:min
- max查詢:max
- avg查詢:avg
- 動态查詢:__call
db/Mongo.php
- 屬性:connection
- 執行指令,傳回資料集:command
- 執行指令:cmd
- 指定distinct查詢:getDistinct
- 擷取資料集:listCollections
- 多聚合查詢:multiAggregate
- 字段值增長:inc
- 字段值減少:dec
- 指定目前的collection:table
- table别名:collection
- 設定typeMap:typeMap
- 未知:awaitData
- 未知:batchSize
- 未知:exhaust
- 設定modifiers:modifiers
- 設定noCursorTimeout:noCursorTimeout
- 設定oplogReplay:oplogReplay
- 設定partial:partial
- 設定maxTimeMS:maxTimeMS
- 未知:collation
- 設定是否replace:replace
- 設定傳回字段:field
- 指定排除字段:withoutField
- 設定skip:skip
- 設定slaveOk:slaveOk
- 指定查詢數量:limit
- 排序:order
- 設定tailable:tailable
- 設定writeConcern:writeConcern
- 擷取主鍵:getPk
- 擷取getCursor:getCursor
- 擷取查詢辨別:getQueryGuid
- 分頁:paginate
- 分批處理資料:chunk
- 分析表達式:parseOptions
- 擷取字段類型資訊:getFieldsType
計劃閱讀
[ ] framework源碼
[ ] orm源碼
[ ] helper源碼