Skip to content

Instantly share code, notes, and snippets.

View dvliman's full-sized avatar

David Liman dvliman

View GitHub Profile
@dvliman
dvliman / spacemacs-cheshe.md
Created March 29, 2019 20:18 — forked from robphoenix/spacemacs-cheshe.md
Spacemacs Cheat Sheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
  • SPC TAB - switch to previous buffer
  • SPC b b - switch buffers
package com.dvliman.demo
// src/main/kotlin/com/dvliman/Router.kt
import com.dvliman.demo.user.UserHandler
import org.springframework.context.annotation.Bean
import org.springframework.http.MediaType.APPLICATION_JSON
import org.springframework.stereotype.Component
import org.springframework.web.reactive.function.server.router
// src/main/kotlin/com/dvliman/user/UserHandler
package com.dvliman.demo.user
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType.APPLICATION_JSON
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.reactive.function.server.ServerRequest
import org.springframework.web.reactive.function.server.ServerResponse
import reactor.core.publisher.Mono
// src/main/kotlin/com/dvliman/demo/user/UserRepo.kt
package com.dvliman.demo.user
import org.davidmoten.rx.jdbc.Database
import org.davidmoten.rx.jdbc.Parameter
import org.springframework.stereotype.Component
import reactor.core.publisher.Mono
import reactor.core.publisher.Flux
import reactor.core.publisher.toFlux
// src/main/kotlin/com/dvliman/demo/user/UserModels.kt
package com.dvliman.demo.user
import org.springframework.web.reactive.function.server.ServerResponse
import org.springframework.http.MediaType.APPLICATION_JSON
import reactor.core.publisher.Mono
data class User(
val user_id: Int,
// src/main/resources/application.properties
demo.db.url = jdbc:postgresql://localhost/demo
// src/main/kotlin/com/dvliman/demo/Beans.kt
package com.dvliman.demo
import org.davidmoten.rx.jdbc.Database
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@Configuration
class Beans {
// build.gradle
dependencies {
implementation 'com.github.davidmoten:rxjava2-jdbc:0.2.2'
implementation 'org.postgresql:postgresql:42.2.5'
}
// src/main/kotlin/com/dvliman/demo/Config.kt
package com.dvliman.demo;
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Component
@Component
class Config {
INSERT INTO users (name, email) VALUES ('some-name', 'some-email');
SELECT * FROM users;
SELECT user_id, name, email FROM users WHERE user_id = '1';