Skip to content

Instantly share code, notes, and snippets.

View steebchen's full-sized avatar
🌴
Working remotely

Luca Steeb steebchen

🌴
Working remotely
View GitHub Profile
@steebchen
steebchen / check.sh
Last active June 9, 2020 07:34
Check if a given Github Action succeeds
#!/bin/sh
# This script checks if the prisma e2e test workflow passes
# Check the end of the file for usage
check() {
str=$(curl -s "https://github.com/$1/workflows/$2/badge.svg")
case "$str" in
*"passing"*)
@steebchen
steebchen / test.md
Last active December 9, 2019 10:22

No

  • a: code(hi) Ok: stuff
  • b: code(hi)

Ok:

localhost/user
localhost/user?name[equals]=stuff
localhost/user?name[contains]=stuff
func (r UserResolver) User(ctx context.Context, input UserFilterInput) (User, error) {
  query := User.Query()
 
localhost/user
localhost/user?name[equals]=stuff
localhost/user?name[contains]=stuff
func (r UserResolver) User(ctx context.Context, input UserFilterInput) (User, error) {
  query := User.Query()
 
user, err := client.User.FindOne().Exec(ctx)

email, ok := user.Email()
if !ok {
  return fmt.Errorf("email is null")
}

log.Printf("User email is set")

Photon Go Versioning

The user should be able to solely work with Go tools:

go get github.com/prisma/photongo

A specific version gets locked with the Go modules lockfile:

Select API

var result struct{
  User struct{
    Name User.Name.Field
    Email User.Email.Field
    Posts []Post
  }
@steebchen
steebchen / photon-go-multi-selection.md
Created June 23, 2019 21:31
Photon Go client: query for multiple things in a single query

Proposal for selecting multiple things as alternative for the initial proposal

Generated Prisma client types

The prisma types could be generated with all relations a type can have. For example, when a User can have Posts and a Post has an Author, the respective types define the relation in the struct.

// generated code by prisma
sudo sed -i "s/#\{0,1\}Port .*/Port xxxx/" /etc/ssh/sshd_config
sudo sed -i "s/#\{0,1\}PasswordAuthentication yes/PasswordAuthentication no/" /etc/ssh/sshd_config
service sshd reload
@steebchen
steebchen / ssh.sh
Last active December 11, 2018 02:02
sudo sed -i "s/#\{0,1\}Port .*/Port xxxx/" /etc/ssh/sshd_config
sudo sed -i "s/#\{0,1\}PermitRootLogin yes/PermitRootLogin no/" /etc/ssh/sshd_config
sudo sed -i "s/#\{0,1\}PasswordAuthentication yes/PasswordAuthentication no/" /etc/ssh/sshd_config
service sshd reload