Skip to content

Conversation

@jeremyrsmith
Copy link
Collaborator

  • Removed postgres.Client.apply
  • Added Postgres.Client() with stack-based config API
  • Added explicit close() on ChannelClosedException (from behind load balancer)

* Removed `postgres.Client.apply`
* Added `Postgres.Client()` with stack-based config API
* Added explicit close() on ChannelClosedException (from behind load balancer)
@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 74.955% when pulling 41d0179 on stack-based-client into bc693f3 on master.

Copy link
Collaborator

@vkostyukov vkostyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @jeremyrsmith!

This looks great! I'm super happy to see finagle-postgres evolving. Thanks to you, it's now one step closer to the Netty 4 support!


def withBinaryParams(enable: Boolean = true) = configured(BinaryParams(enable))
def withBinaryResults(enable: Boolean = true) = configured(BinaryResults(enable))
def database(database: String) = configured(Database(database))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

withDatabase?

}
}

def dest(name: Name): Client = configured(Dest(name))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need this. Dest passed as part of newService call.

def database(database: String) = configured(Database(database))
def withCustomTypes(customTypes: Map[Int, postgres.Client.TypeSpecifier]) =
configured(CustomTypes(Some(customTypes)))
def withDefaultTypes() = configured(CustomTypes(Some(postgres.Client.defaultTypes)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for ().

id: String,
useSsl: Boolean,
trustManagerFactory: TrustManagerFactory = InsecureTrustManagerFactory.INSTANCE
) extends CodecFactory[PgRequest, PgResponse] {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm so happy to see this!

// because postgres doesn't start out in TLS
)

case class Client(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually provide a default instance:

val client = Client() // and then

val c = Postgres.client.with...
``

type In = PgRequest
type Out = PgResponse

def newRichClient(): postgres.Client = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can have newRichClient taking Name instead of grabbing it from stack params.

@jeremyrsmith jeremyrsmith merged commit 635c503 into master Nov 1, 2016
@jeremyrsmith jeremyrsmith deleted the stack-based-client branch November 1, 2016 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants