pre-dev: initial commit

This commit is contained in:
2025-08-11 10:25:54 +07:00
parent e0ecf1c906
commit ee9b4a9035
50 changed files with 1020 additions and 1 deletions
View File
@@ -0,0 +1,40 @@
/*
DESCRIPTION:
Sample of the use-case that has fully CRUD functionality. Uses object with CRUD
functions to satisfy CRUD interface so it will be able to be generated into
CRUD routing.
Functions other than CRUD can be writen outside the object.
*/
package crud
import (
"net/http"
)
type myBase struct{}
var O myBase
func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
// MULAI MEETING E
// JIKA SUATU SAAT MAU OUTPUT XML, HANDLER YG MELAKUKAN
// BUKAN CASE
// YES MIRIP HANDLER
// MEETING E MULAI
}
func (obj myBase) Read(w http.ResponseWriter, r *http.Request) {
}
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
}
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
}
func OtherFunc(w http.ResponseWriter, r *http.Request) {
}
func AnotherFunc(w http.ResponseWriter, r *http.Request) {
}
@@ -0,0 +1,16 @@
/*
DESCRIPTION:
Sample of a use-case that has fully CRUD functionality. User Id and the other
things related to credentials are passed within the dto.
*/
package invokeauth
import (
"net/http"
)
func SomeFunc(w http.ResponseWriter, r *http.Request) {
// if dto.User_Id > 0 {
// query = query.Where("User_Id = ?", dto.User_Id)
// }
}
@@ -0,0 +1,15 @@
package crud
import (
"net/http"
)
type myBase struct{}
var O myBase
func SomeFunc(w http.ResponseWriter, r *http.Request) {
}
func Read(w http.ResponseWriter, r *http.Request) {
}
@@ -0,0 +1,23 @@
package home
import (
"encoding/json"
"net/http"
)
func Home(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
jsonText, _ := json.Marshal(map[string]string{"message": "Resource can not be found!!"})
w.WriteHeader(http.StatusNotFound)
w.Write(jsonText)
return
}
jsonText, _ := json.Marshal(map[string]string{"message": "Welcome to the API"})
w.Write(jsonText)
}
func TempResponse(w http.ResponseWriter, r *http.Request) {
jsonText, _ := json.Marshal(map[string]string{"message": "Nice move by the programmer, now tell him that he forgot this part"})
w.Write(jsonText)
}
@@ -0,0 +1,25 @@
package handler
import (
"net/http"
///// PKG
handlerlogger "simrs-vx/pkg/middleware/handler-logger"
///// Internal
"simrs-vx/internal/interface/main-handler/home"
)
// One place route to relatively easier to manage, ESPECIALLY in tracking
func SetRoutes() http.Handler {
/////
// a.RegisterExtCall(gs.Adjust)
r := http.NewServeMux()
/******************** Main ********************/
r.HandleFunc("/", home.Home)
/////
return handlerlogger.SetLog(r)
}