还会更新,只是懒得整理,先堆这里了
PlatUML 代码:
@startuml
' 底层驱动部分
class DatabaseManager{
connection() factory的大脑
}
class ConnectionFactory{
newConnection()
}
interface Connection {
defaultBuilder
defaultGrammar
defaultProcesser
run() // 真正到DB里跑SQL的
}
interface Connector {
connect()
}
package Query|Schema {
interface Grammar
interface Processer
note right of Processer: 对数据库返回值的二次拼装
class QueryBuilder {
IConnection
IGrammar
IProcesser
paginate()
}
}
DatabaseManager *--> ConnectionFactory
DatabaseManager *--> Connection
DatabaseManager *--> Connector
ConnectionFactory *--> Connection
ConnectionFactory *--> Connector
Connection --|> Grammar
Connection --|> Processer
QueryBuilder --|> Grammar
QueryBuilder --|> Processer
Connection -- QueryBuilder
' Eloquent
package Eloquent{
abstract class Relation{
Ebuilder
constraints
}
class EBuilder{
model
scopes
earerLoad
macro
first()
has()
}
class model{
scopes
events
__call()
serialize()
}
}
@enduml