Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
putuadityabayu committed Aug 27, 2023
0 parents commit 3d37ed4
Show file tree
Hide file tree
Showing 37 changed files with 2,478 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on:
pull_request:
paths:
- '**.go'
push:
branches:
- main
name: Security
jobs:
GoSecurity:
runs-on: ubuntu-latest
steps:
- name: Fetch Repository
uses: actions/checkout@v3
- name: Run Gosec
uses: securego/gosec@master
43 changes: 43 additions & 0 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Unit Testing

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
utils-test:
strategy:
matrix:
go-version: [1.19.x,1.20.x,1.21.x]
platform: [ubuntu-latest, windows-latest, macos-latest]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Setup Golang caches
uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
- name: Test
run: go test -v ./...
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Portalnesia

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
63 changes: 63 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[![Go Reference](https://pkg.go.dev/badge/go.portalnesia.com/saka.svg)](https://pkg.go.dev/go.portalnesia.com/saka) ![Go](https://github.com/portalnesia/go-saka/actions/workflows/unit_test.yml/badge.svg)

# Saka

Saka is a Go library for working with the Balinese calendar system. This library provides functionalities to convert Gregorian dates to Balinese calendar dates and vice versa. It also offers features to retrieve Hindu holidays, important cultural events, and auspicious days.

## Installation

To use Saka in your Go project, you need to install it using go get:

```bash
go get -u go.portalnesia.com/saka
```

## Usage

```go
package main

import (
"go.portalnesia.com/saka"
"github.com/golang-module/carbon"
)

func oneDate() {
saka_instance := saka.New()

// Get information about the date
saka_instance.EkaWara
saka_instance.PancaWara
saka_instance.Sasih
// and others...

all_rahinan := saka_instance.Rahinan()
// todo with list rahinan
if all_rahinan[0] == saka.Enum.Rahinan.Nyepi {

}
// and others...

}

func rangeDate() {
d1 := carbon.CreateFromDate(2023, 8, 27)
d2 := carbon.CreateFromDate(2023, 8, 31)

saka_instance := saka.NewRange(d1,d2)

// List all rahinan
all_rahinan := saka_instance.ListAllRahinan()

// List by date
date_list := saka_instance.ListByDate()
}
```

## Go Reference

[pkg.go.dev/go.portalnesia.com/saka](https://pkg.go.dev/go.portalnesia.com/saka)

## Thanks To

- [github.com/peradnya/balinese-date-js-lib](https://github.com/peradnya/balinese-date-js-lib) - Balinese calendar library for Javascript/Typescript
42 changes: 42 additions & 0 deletions asta_wara.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
Copyright © Portalnesia <support@portalnesia.com>
*/
package saka

type AstaWara struct {
Sri Wara
Indra Wara
Guru Wara
Yama Wara
Ludra Wara
Brahma Wara
Kala Wara
Uma Wara
}

func newAstaWara() AstaWara {
return AstaWara{
Sri: Wara{ID: 0, Urip: 6, Name: "Sri"},
Indra: Wara{ID: 1, Urip: 5, Name: "Indra"},
Guru: Wara{ID: 2, Urip: 8, Name: "Guru"},
Yama: Wara{ID: 3, Urip: 9, Name: "Yama"},
Ludra: Wara{ID: 4, Urip: 3, Name: "Ludra"},
Brahma: Wara{ID: 5, Urip: 7, Name: "Brahma"},
Kala: Wara{ID: 6, Urip: 1, Name: "Kala"},
Uma: Wara{ID: 7, Urip: 4, Name: "Uma"},
}
}

func newAstaWaraSlice() []Wara {
astawara := newAstaWara()
return []Wara{
astawara.Sri,
astawara.Indra,
astawara.Guru,
astawara.Yama,
astawara.Ludra,
astawara.Brahma,
astawara.Kala,
astawara.Uma,
}
}
25 changes: 25 additions & 0 deletions catur_wara.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
Copyright © Portalnesia <support@portalnesia.com>
*/
package saka

type CaturWara struct {
Sri Wara
Laba Wara
Jaya Wara
Menala Wara
}

func newCaturWara() CaturWara {
return CaturWara{
Sri: Wara{0, 6, "Sri"},
Laba: Wara{1, 5, "Laba"},
Jaya: Wara{2, 1, "Jaya"},
Menala: Wara{3, 8, "Menala"},
}
}

func newCaturWaraSlice() []Wara {
wara := newCaturWara()
return []Wara{wara.Sri, wara.Laba, wara.Jaya, wara.Menala}
}
48 changes: 48 additions & 0 deletions dasa_wara.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
Copyright © Portalnesia <support@portalnesia.com>
*/
package saka

type DasaWara struct {
Pandita Wara
Pati Wara
Suka Wara
Duka Wara
Sri Wara
Manuh Wara
Manusa Wara
Raja Wara
Dewa Wara
Raksasa Wara
}

func newDasaWara() DasaWara {
return DasaWara{
Pandita: Wara{0, 5, "Pandita"},
Pati: Wara{1, 7, "Pati"},
Suka: Wara{2, 10, "Suka"},
Duka: Wara{3, 4, "Duka"},
Sri: Wara{4, 6, "Sri"},
Manuh: Wara{5, 2, "Manuh"},
Manusa: Wara{6, 3, "Manusa"},
Raja: Wara{7, 8, "Raja"},
Dewa: Wara{8, 9, "Dewa"},
Raksasa: Wara{9, 1, "Raksasa"},
}
}

func newDasaWaraSlice() []Wara {
wara := newDasaWara()
return []Wara{
wara.Pandita,
wara.Pati,
wara.Suka,
wara.Duka,
wara.Sri,
wara.Manuh,
wara.Manusa,
wara.Raja,
wara.Dewa,
wara.Raksasa,
}
}
24 changes: 24 additions & 0 deletions dwi_wara.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copyright © Portalnesia <support@portalnesia.com>
*/
package saka

type DwiWara struct {
Menga Wara
Pepet Wara
}

func newDwiWara() DwiWara {
return DwiWara{
Menga: Wara{0, 5, "Menga"},
Pepet: Wara{1, 4, "Pepet"},
}
}

func newDwiWaraSlice() []Wara {
wara := newDwiWara()
return []Wara{
wara.Menga,
wara.Pepet,
}
}
Loading

0 comments on commit 3d37ed4

Please sign in to comment.