Skip to content

Instantly share code, notes, and snippets.

View anta40's full-sized avatar

Andre anta40

  • Jakarta, Indonesia
  • 18:56 (UTC +07:00)
View GitHub Profile
package main
import (
"database/sql"
"encoding/json"
"fmt"
"log"
"net/http"
"time"
package manhattan.email.bot.google;
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.Base64;
import com.google.api.services.gmail.Gmail;
import com.google.api.services.gmail.model.ListMessagesResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONException;
import org.json.JSONObject;
models/login.go
----------------
package models
type LoginParam struct {
Username string `form:"username" json:"username"`
Password string `form:"password" json:"password"`
}
type Response struct {
type NullString struct {
sql.NullString
}
type NullTime struct {
sql.NullString
}
func (ns *NullString) MarshalJSON() ([]byte, error) {
if !ns.Valid {
type NullTime struct {
sql.NullString
}
func (nt *NullTime) MarshalJSON() ([]byte, error) {
if !nt.NullString.Valid {
return []byte("null"), nil
}
t, _ := time.Parse(time.RFC3339, nt.String)
package main
import (
"database/sql"
"encoding/json"
"fmt"
"log"
"net/http"
"time"
package main
import (
"database/sql"
"encoding/json"
"fmt"
"log"
"net/http"
"time"
[
{
"id": "9",
"name": "Tester 02",
"date": "25-09-2019",
"checkintime": "14:56:39",
"checkouttime": "15:52:22",
"checkindistance": {
"Int64": 0,
"Valid": true