1 module hunt.database.driver.mysql.MySQLPool;
2 
3 import hunt.database.driver.mysql.impl.MySQLPoolImpl;
4 import hunt.database.driver.mysql.MySQLConnectOptions;
5 
6 import hunt.database.base.AsyncResult;
7 import hunt.database.base.PoolOptions;
8 import hunt.database.base.Pool;
9 import hunt.database.base.Row;
10 import hunt.database.base.RowSet;
11 import hunt.database.base.SqlResult;
12 import hunt.database.base.Tuple;
13 
14 import hunt.collection.List;
15 
16 /**
17  * A pool of MySQL connections.
18  */
19 interface MySQLPool : Pool {
20 
21     /**
22      * Like {@link #pool(String, PoolOptions)} with a default {@code poolOptions}.
23      */
24     // static MySQLPool pool(String connectionUri) {
25     //     return pool(connectionUri, new PoolOptions());
26     // }
27 
28     /**
29      * Like {@link #pool(MySQLConnectOptions, PoolOptions)} with {@code connectOptions} build from {@code connectionUri}.
30      */
31     // static MySQLPool pool(String connectionUri, PoolOptions poolOptions) {
32     //     return pool(fromUri(connectionUri), poolOptions);
33     // }
34 
35     /**
36      * Like {@link #pool(Vertx, MySQLConnectOptions, PoolOptions)} with {@code connectOptions} build from {@code connectionUri}.
37      */
38     // static MySQLPool pool(String connectionUri, PoolOptions poolOptions) {
39     //     return pool(vertx, fromUri(connectionUri), poolOptions);
40     // }
41 
42     /**
43      * Create a connection pool to the MySQL server configured with the given {@code connectOptions} and {@code poolOptions}.
44      *
45      * @param connectOptions the options for the connection
46      * @param poolOptions the options for creating the pool
47      * @return the connection pool
48      */
49     // static MySQLPool pool(MySQLConnectOptions connectOptions, PoolOptions poolOptions) {
50     //     if (Vertx.currentContext() !is null) {
51     //         throw new IllegalStateException("Running in a Vertx context => use MySQLPool#pool(Vertx, MySQLConnectOptions, PoolOptions) instead");
52     //     }
53     //     VertxOptions vertxOptions = new VertxOptions();
54     //     Vertx vertx = Vertx.vertx(vertxOptions);
55     //     return new MySQLPoolImpl(vertx.getOrCreateContext(), true, connectOptions, poolOptions);
56     // }
57 
58     /**
59      * Like {@link #pool(MySQLConnectOptions, PoolOptions)} with a specific {@link Vertx} instance.
60      */
61     static MySQLPool pool(MySQLConnectOptions connectOptions, PoolOptions poolOptions) {
62         return new MySQLPoolImpl(connectOptions, poolOptions);
63     }
64 
65     // override
66     // MySQLPool preparedQuery(String sql, RowSetHandler handler);
67 
68 
69     // override
70     // <R> MySQLPool preparedQuery(String sql, Collector<Row, ?, R> collector, Handler!(AsyncResult!(SqlResult!(R))) handler);
71 
72     // override
73     // MySQLPool query(String sql, RowSetHandler handler);
74 
75 
76     // override
77     // <R> MySQLPool query(String sql, Collector<Row, ?, R> collector, Handler!(AsyncResult!(SqlResult!(R))) handler);
78 
79     // override
80     // MySQLPool preparedQuery(String sql, Tuple arguments, RowSetHandler handler);
81 
82 
83     // override
84     // <R> MySQLPool preparedQuery(String sql, Tuple arguments, Collector<Row, ?, R> collector, Handler!(AsyncResult!(SqlResult!(R))) handler);
85 
86     // override
87     // MySQLPool preparedBatch(String sql, List!(Tuple) batch, RowSetHandler handler);
88 
89 
90     // override
91     // <R> MySQLPool preparedBatch(String sql, List!(Tuple) batch, Collector<Row, ?, R> collector, Handler!(AsyncResult!(SqlResult!(R))) handler);
92 }