src/Leevel/Database/Select.php
public function select($data = null, array $bind = [], bool $flag = false)
    {
        // 查询对象直接查询
        if ($data instanceof self) {
            return $data->find(null, $this->onlyMakeSql);
        }

        // 回调
        if ($data instanceof Closure) {
            call_user_func_array($data, [
                $this,
            ]);
            $data = null;
        }

        // 调用查询
        if (null === $data) {
            return $this->find(null, $flag);
        }

        return $this
            ->safeSql($flag)
            ->runNativeSql(...[
                'select',
                $data,
                $bind,
            ]);
    }
public function select($data = null, array $bind = [], bool $flag = false)
    {
        // 查询对象直接查询
        if ($data instanceof self) {
            return $data->find(null, $this->onlyMakeSql);
        }

        // 回调
        if ($data instanceof Closure) {
            call_user_func_array($data, [
                $this,
            ]);
            $data = null;
        }

        // 调用查询
        if (null === $data) {
            return $this->find(null, $flag);
        }

        return $this
            ->safeSql($flag)
            ->runNativeSql(...[
                'select',
                $data,
                $bind,
            ]);
    }
原生 sql 查询数据 select.

@param null|callable|select|string $data
@param array                       $bind
@param bool                        $flag 指示是否不做任何操作只返回 SQL

@return mixed